Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1308370

[patch] x86/AMD: remove an unneeded condition in srat_detect_node()

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject [patch] x86/AMD: remove an unneeded condition in srat_detect_node()
Date 2016-01-13 13:50 +0100
Message-ID <qQt2a-8ek-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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))

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[patch] x86/AMD: remove an unneeded condition in srat_detect_node() Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-13 13:50 +0100
  [tip:x86/urgent] x86/cpu/amd:   Remove an unneeded condition in srat_detect_node() tip-bot for Dan Carpenter <tipbot@zytor.com> - 2016-01-14 10:10 +0100

csiph-web