Skip to contentSkip to conversation

mtd m25p80: regression fix for chip detection

PATCH New David Brownell 1 participant 1 message Nov 17, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd m25p80: regression fix for chip detection

From: David Brownell <[email protected]>

The "m25p80.c extended jedec support" patch introduced a regression whereby every chip ended up matching the first entry in the list of chips, since it parenthesized a test incorrectly.

This bug could cause MTD filesystem corruption, and all sorts crazy stuff since all chips would appear to be small (128KB) Atmel chips instead of what they really were.

---
 drivers/mtd/devices/m25p80.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/devices/m25p80.c +2 -1
@@ -574,10 +574,11 @@ static struct flash_info *__devinit jede
 	for (tmp = 0, info = m25p_data;
 			tmp < ARRAY_SIZE(m25p_data);
 			tmp++, info++) {
-		if (info->jedec_id == jedec)
+		if (info->jedec_id == jedec) {
 			if (ext_jedec != 0 && info->ext_id != ext_jedec)
 				continue;
 			return info;
+		}
 	}
 	dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec);
 	return NULL;