amd64_edac: Fix condition to verify max channels allowed for F15 M30h
authorAravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Wed, 4 Dec 2013 17:40:11 +0000 (11:40 -0600)
committerBorislav Petkov <bp@suse.de>
Fri, 6 Dec 2013 09:04:17 +0000 (10:04 +0100)
The value returned from 'f15_m30h_determine_channel' will
always be 0x3 max. The condition

(channel > 4 || channel < 0)

works as hardware never returns a value of 4, but
it leads to static checker analysis errors like
http://marc.info/?l=linux-edac&m=138607615131951&w=2.

Fix that.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Link: http://lkml.kernel.org/r/20131203130857.GA32170@elgon.mountain
[ Boris: massage commit message a bit. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
drivers/edac/amd64_edac.c

index b53d0de17e155290294238c0add6aec7dea9cbff..e2079b2dfcb4a677406586b36ab1e8542de57103 100644 (file)
@@ -1578,7 +1578,7 @@ static int f15_m30h_match_to_this_node(struct amd64_pvt *pvt, unsigned range,
                                             num_dcts_intlv, dct_sel);
 
        /* Verify we stay within the MAX number of channels allowed */
-       if (channel > 4 || channel < 0)
+       if (channel > 3)
                return -EINVAL;
 
        leg_mmio_hole = (u8) (dct_cont_base_reg >> 1 & BIT(0));
This page took 0.036546 seconds and 5 git commands to generate.