Patchwork m25p80: fix detection of SPI parts

login
register
mail settings
Submitter Mike Frysinger
Date Oct. 29, 2008, 1:21 p.m.
Message ID <1225286467-17955-1-git-send-email-vapier@gentoo.org>
Download mbox | patch
Permalink /patch/6251/
State Accepted
Commit a3d3f73ccbd68b3557c4aaf9f6246ea21d922835
Headers show

Comments

Mike Frysinger - Oct. 29, 2008, 1:21 p.m.
Commit d0e8c47c58575b9131e786edb488fd029eba443e added support for extended
ids but in the process managed to break detection of all flashes.  The ext
jedec id check was inserted into an if statement that lacked braces, and
it did not add the required braces.  As such, the detection routine always
returns the first entry in the SPI flash list.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 drivers/mtd/devices/m25p80.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 76a7675..a298fed 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -574,10 +574,11 @@  static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
 	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;