All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Thomas Gleixner <tglx@linutronix.de>, Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Borislav Petkov <bp@suse.de>,
	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
	Andy Lutomirski <luto@kernel.org>, Huang Rui <ray.huang@amd.com>,
	Hector Marco-Gisbert <hecmargi@upv.es>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] x86/AMD: remove an unneeded condition in srat_detect_node()
Date: Wed, 13 Jan 2016 12:39:40 +0000	[thread overview]
Message-ID: <20160113123940.GE19993@mwanda> (raw)

Originally we calculated ht_nodeid as "ht_nodeid = apicid - boot_cpu_id;"
so presumably it could be negative.  But after commit 01aaea1afbcd
('x86: introduce initial apicid') we use c->initial_apicid which is an
unsigned short and thus always >= 0.

It causes a static checker warning to test for impossible conditions so
let's remove it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index e678dde..a07956a 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -434,8 +434,7 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
 		 */
 		int ht_nodeid = c->initial_apicid;
 
-		if (ht_nodeid >= 0 &&
-		    __apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
+		if (__apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
 			node = __apicid_to_node[ht_nodeid];
 		/* Pick a nearby node */
 		if (!node_online(node))

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Thomas Gleixner <tglx@linutronix.de>, Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Borislav Petkov <bp@suse.de>,
	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
	Andy Lutomirski <luto@kernel.org>, Huang Rui <ray.huang@amd.com>,
	Hector Marco-Gisbert <hecmargi@upv.es>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] x86/AMD: remove an unneeded condition in srat_detect_node()
Date: Wed, 13 Jan 2016 15:39:40 +0300	[thread overview]
Message-ID: <20160113123940.GE19993@mwanda> (raw)

Originally we calculated ht_nodeid as "ht_nodeid = apicid - boot_cpu_id;"
so presumably it could be negative.  But after commit 01aaea1afbcd
('x86: introduce initial apicid') we use c->initial_apicid which is an
unsigned short and thus always >= 0.

It causes a static checker warning to test for impossible conditions so
let's remove it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index e678dde..a07956a 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -434,8 +434,7 @@ static void srat_detect_node(struct cpuinfo_x86 *c)
 		 */
 		int ht_nodeid = c->initial_apicid;
 
-		if (ht_nodeid >= 0 &&
-		    __apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
+		if (__apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
 			node = __apicid_to_node[ht_nodeid];
 		/* Pick a nearby node */
 		if (!node_online(node))

             reply	other threads:[~2016-01-13 12:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13 12:39 Dan Carpenter [this message]
2016-01-13 12:39 ` [patch] x86/AMD: remove an unneeded condition in srat_detect_node() Dan Carpenter
2016-01-14  5:48 ` Huang Rui
2016-01-14  5:48   ` Huang Rui
2016-01-14  9:07 ` [tip:x86/urgent] x86/cpu/amd: Remove " tip-bot for Dan Carpenter

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=20160113123940.GE19993@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=bp@suse.de \
    --cc=hecmargi@upv.es \
    --cc=hpa@zytor.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=ray.huang@amd.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yhlu.kernel@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.