aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/amd64_edac.c
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2011-02-21 12:55:00 -0500
committerBorislav Petkov <borislav.petkov@amd.com>2011-03-17 09:46:28 -0400
commitb487c33e55eb7e18cd98094f7159c6d9e8b6bedd (patch)
tree56fe006bf392c090a8d2fcf2a2109055e3279fda /drivers/edac/amd64_edac.c
parentd88977a9c433deb7e558e0af51092449ef2ad2dd (diff)
amd64_edac: Fix node id signedness
A node id can never be negative since we use it as an index into the DRAM ranges array. This also makes one of the BUG_ON conditions redundant. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac/amd64_edac.c')
-rw-r--r--drivers/edac/amd64_edac.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 70e0f84be0d8..8d9def57232b 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -226,7 +226,8 @@ static int amd64_get_scrub_rate(struct mem_ctl_info *mci)
226 * returns true if the SysAddr given by sys_addr matches the 226 * returns true if the SysAddr given by sys_addr matches the
227 * DRAM base/limit associated with node_id 227 * DRAM base/limit associated with node_id
228 */ 228 */
229static bool amd64_base_limit_match(struct amd64_pvt *pvt, u64 sys_addr, int nid) 229static bool amd64_base_limit_match(struct amd64_pvt *pvt, u64 sys_addr,
230 unsigned nid)
230{ 231{
231 u64 addr; 232 u64 addr;
232 233
@@ -252,7 +253,7 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci,
252 u64 sys_addr) 253 u64 sys_addr)
253{ 254{
254 struct amd64_pvt *pvt; 255 struct amd64_pvt *pvt;
255 int node_id; 256 unsigned node_id;
256 u32 intlv_en, bits; 257 u32 intlv_en, bits;
257 258
258 /* 259 /*
@@ -302,7 +303,7 @@ static struct mem_ctl_info *find_mc_by_sys_addr(struct mem_ctl_info *mci,
302 } 303 }
303 304
304found: 305found:
305 return edac_mc_find(node_id); 306 return edac_mc_find((int)node_id);
306 307
307err_no_match: 308err_no_match:
308 debugf2("sys_addr 0x%lx doesn't match any node\n", 309 debugf2("sys_addr 0x%lx doesn't match any node\n",
@@ -602,7 +603,7 @@ static u64 sys_addr_to_input_addr(struct mem_ctl_info *mci, u64 sys_addr)
602static u64 input_addr_to_dram_addr(struct mem_ctl_info *mci, u64 input_addr) 603static u64 input_addr_to_dram_addr(struct mem_ctl_info *mci, u64 input_addr)
603{ 604{
604 struct amd64_pvt *pvt; 605 struct amd64_pvt *pvt;
605 int node_id, intlv_shift; 606 unsigned node_id, intlv_shift;
606 u64 bits, dram_addr; 607 u64 bits, dram_addr;
607 u32 intlv_sel; 608 u32 intlv_sel;
608 609
@@ -616,7 +617,8 @@ static u64 input_addr_to_dram_addr(struct mem_ctl_info *mci, u64 input_addr)
616 */ 617 */
617 pvt = mci->pvt_info; 618 pvt = mci->pvt_info;
618 node_id = pvt->mc_node_id; 619 node_id = pvt->mc_node_id;
619 BUG_ON((node_id < 0) || (node_id > 7)); 620
621 BUG_ON(node_id > 7);
620 622
621 intlv_shift = num_node_interleave_bits(dram_intlv_en(pvt, 0)); 623 intlv_shift = num_node_interleave_bits(dram_intlv_en(pvt, 0));
622 624
@@ -2147,7 +2149,7 @@ static int init_csrows(struct mem_ctl_info *mci)
2147} 2149}
2148 2150
2149/* get all cores on this DCT */ 2151/* get all cores on this DCT */
2150static void get_cpus_on_this_dct_cpumask(struct cpumask *mask, int nid) 2152static void get_cpus_on_this_dct_cpumask(struct cpumask *mask, unsigned nid)
2151{ 2153{
2152 int cpu; 2154 int cpu;
2153 2155
@@ -2157,7 +2159,7 @@ static void get_cpus_on_this_dct_cpumask(struct cpumask *mask, int nid)
2157} 2159}
2158 2160
2159/* check MCG_CTL on all the cpus on this node */ 2161/* check MCG_CTL on all the cpus on this node */
2160static bool amd64_nb_mce_bank_enabled_on_node(int nid) 2162static bool amd64_nb_mce_bank_enabled_on_node(unsigned nid)
2161{ 2163{
2162 cpumask_var_t mask; 2164 cpumask_var_t mask;
2163 int cpu, nbe; 2165 int cpu, nbe;