Skip to contentSkip to conversation

tg3: Fix NVRAM selftest

PATCH In review Matt Carlson 1 participant 1 message Mar 10, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/7 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.

---
 drivers/net/tg3.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/tg3.c +4 -2
index 6fd5cf0..8f71608 100644
@@ -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;
Signature · 1 line
1.7.3.4