[tip:x86/uv] x86/UV: Check for alloc_cpumask_var() failures properly in uv_nmi_setup()

From: tip-bot for Ingo Molnar
Date: Tue Sep 24 2013 - 04:38:56 EST

Commit-ID: 8a1f4653f27ffd5d61088cf6b95c39bb13bf6132
Gitweb: http://git.kernel.org/tip/8a1f4653f27ffd5d61088cf6b95c39bb13bf6132
Author: Ingo Molnar <mingo@xxxxxxxxxx>
AuthorDate: Tue, 24 Sep 2013 09:52:40 +0200
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Tue, 24 Sep 2013 09:52:40 +0200

x86/UV: Check for alloc_cpumask_var() failures properly in uv_nmi_setup()

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);

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

Cc: Mike Travis <travis@xxxxxxx>
Link: http://lkml.kernel.org/n/tip-2pXRemsjupmvonbpmmnzleo1@xxxxxxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
arch/x86/platform/uv/uv_nmi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
index c171ca5..9126dfb 100644
--- a/arch/x86/platform/uv/uv_nmi.c
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -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));

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/