Subject: Re: [PATCH] [POWERPC] Fix return value check logic

From: Michael Ellerman <[email-masked]>
Date: Fri, 23 May 2008 11:13:10 +1000

On Thu, 2008-05-22 at 14:49 -0500, Emil Medve wrote:
> debugfs_create_file() return a non-NULL (non-zero) value in case of success
> 
> This fixes this non-critical boot-time debuging error message:
> 
> [    1.316386] calling  irq_debugfs_init+0x0/0x50
> [    1.316399] initcall irq_debugfs_init+0x0/0x50 returned -12 after 0 msecs
> [    1.316411] initcall irq_debugfs_init+0x0/0x50 returned with error code -12
> 
> Signed-off-by: Emil Medve <[email-masked]>
> ---
> 
> $ scripts/checkpatch.pl 0001--POWERPC-Fix-return-value-check-logic.patch 
> total: 0 errors, 0 warnings, 8 lines checked
> 
> 0001--POWERPC-Fix-return-value-check-logic.patch has no obvious style problems and is ready for submission.
> 
>  arch/powerpc/kernel/irq.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
> index 2f73f70..bcc249d 100644
> --- a/arch/powerpc/kernel/irq.c
> +++ b/arch/powerpc/kernel/irq.c
> @@ -1073,7 +1073,7 @@ static const struct file_operations virq_debug_fops = {
>  static int __init irq_debugfs_init(void)
>  {
>  	if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root,
> -				 NULL, &virq_debug_fops))
> +				 NULL, &virq_debug_fops) == NULL)
>  		return -ENOMEM;

That won't work if CONFIG_DEBUG_FS is not defined, because in that case
debugfs_create_file() returns -ENODEV. I guess the whole virq debug code
should be wrapped in #ifdef CONFIG_DEBUG_FS.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person