linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Ingo Molnar <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	travis@sgi.com, tglx@linutronix.de
Subject: [tip:x86/uv] x86/UV: Check for alloc_cpumask_var() failures properly in uv_nmi_setup()
Date: Tue, 24 Sep 2013 01:38:16 -0700	[thread overview]
Message-ID: <tip-8a1f4653f27ffd5d61088cf6b95c39bb13bf6132@git.kernel.org> (raw)

Commit-ID:  8a1f4653f27ffd5d61088cf6b95c39bb13bf6132
Gitweb:     http://git.kernel.org/tip/8a1f4653f27ffd5d61088cf6b95c39bb13bf6132
Author:     Ingo Molnar <mingo@kernel.org>
AuthorDate: Tue, 24 Sep 2013 09:52:40 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
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);
        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 | 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));
 }
 
 

                 reply	other threads:[~2013-09-24  8:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-8a1f4653f27ffd5d61088cf6b95c39bb13bf6132@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=travis@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).