aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-03-09 16:58:20 +0000
committerDavid S. Miller <davem@davemloft.net>2011-03-10 01:56:11 -0800
commit01c3a3920f9f78866420b2004602944fca45083a (patch)
treed7b8a9106ee61835510b09ce66b3e705df7df487 /drivers/net/tg3.c
parenttg3: Add missed 5719 workaround change (diff)
downloadlinux-dev-01c3a3920f9f78866420b2004602944fca45083a.tar.xz
linux-dev-01c3a3920f9f78866420b2004602944fca45083a.zip
tg3: Fix NVRAM selftest
The tg3 NVRAM selftest actually fails when validating the checksum of the legacy NVRAM format. However, the test still reported success because the last update of the return code was a success from the NVRAM reads. This patch fixes the code so that the error return code defaults to a failure status. Then the patch fixes the reason why the checsum validation failed. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Reviewed-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 6fd5cf055830..8f7160812e06 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10487,14 +10487,16 @@ static int tg3_test_nvram(struct tg3 *tp)
goto out;
}
+ err = -EIO;
+
/* Bootstrap checksum at offset 0x10 */
csum = calc_crc((unsigned char *) buf, 0x10);
- if (csum != be32_to_cpu(buf[0x10/4]))
+ if (csum != le32_to_cpu(buf[0x10/4]))
goto out;
/* Manufacturing block starts at offset 0x74, checksum at 0xfc */
csum = calc_crc((unsigned char *) &buf[0x74/4], 0x88);
- if (csum != be32_to_cpu(buf[0xfc/4]))
+ if (csum != le32_to_cpu(buf[0xfc/4]))
goto out;
err = 0;