]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
x86/UV: Check for alloc_cpumask_var() failures properly in uv_nmi_setup()
authorIngo Molnar <mingo@kernel.org>
Tue, 24 Sep 2013 07:52:40 +0000 (09:52 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 24 Sep 2013 07:52:40 +0000 (09:52 +0200)
GCC warned about:

   arch/x86/platform/uv/uv_nmi.c: In function ‘uv_nmi_setup’:
   arch/x86/platform/uv/uv_nmi.c:664:2: warning: the address of ‘uv_nmi_cpu_mask’ will always evaluate as ‘true’

The reason is this code:

        alloc_cpumask_var(&uv_nmi_cpu_mask, GFP_KERNEL);
        BUG_ON(!uv_nmi_cpu_mask);

which is not the way to check for alloc_cpumask_var() failures - its
return code should be checked instead.

Cc: Mike Travis <travis@sgi.com>
Link: http://lkml.kernel.org/n/tip-2pXRemsjupmvonbpmmnzleo1@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/platform/uv/uv_nmi.c

index c171ca5331564d5f4c30610ac9c0032c87a1cbf2..9126dfb6dbfca3fce7a93dc5d264c234108d4ca6 100644 (file)
@@ -660,8 +660,7 @@ void uv_nmi_setup(void)
                }
                uv_hub_nmi_per(cpu) = uv_hub_nmi_list[nid];
        }
-       alloc_cpumask_var(&uv_nmi_cpu_mask, GFP_KERNEL);
-       BUG_ON(!uv_nmi_cpu_mask);
+       BUG_ON(!alloc_cpumask_var(&uv_nmi_cpu_mask, GFP_KERNEL));
 }