From cccb45d4b34728d33638085435f8fdc0a83e0c00 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 19 Nov 2007 15:37:23 +0200 Subject: [MTD] mtd_dataflash: Incorrect compare-after-write check After writing to a Dataflash page, the built-in compare operation is used to check that the page was successfully written. A logic bug in checking the results of the comparison currently causes the compare to never fail. This bug was originally in the legacy at91_dataflash.c driver. Signed-off-by: Andrew Victor Acked-by: David Brownell Signed-off-by: David Woodhouse --- drivers/mtd/devices/mtd_dataflash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/mtd/devices') diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index a5ed6d2..b35e481 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -420,7 +420,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len, status = dataflash_waitready(priv->spi); /* Check result of the compare operation */ - if ((status & (1 << 6)) == 1) { + if (status & (1 << 6)) { printk(KERN_ERR "%s: compare page %u, err %d\n", spi->dev.bus_id, pageaddr, status); remaining = 0; -- cgit v1.1 From 0bdf77f85bd89d5e00d32af0fb7d2dac63ce8ff5 Mon Sep 17 00:00:00 2001 From: Roel Kluin <12o3l@tiscali.nl> Date: Mon, 28 Jan 2008 11:48:09 +0100 Subject: [MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.c drivers/mtd/devices/lart.c:119:#define FLASH_DEVICE_16mbit_BOTTOM 0x88f488f4 As was, unless "manufacturer != FLASH_MANUFACTURER" this returned true Signed-off-by: Roel Kluin <12o3l@tiscali.nl> Signed-off-by: David Woodhouse --- drivers/mtd/devices/lart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/mtd/devices') diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c index 4ea50a1..99fd210 100644 --- a/drivers/mtd/devices/lart.c +++ b/drivers/mtd/devices/lart.c @@ -323,7 +323,7 @@ static int flash_probe (void) /* put the flash back into command mode */ write32 (DATA_TO_FLASH (READ_ARRAY),0x00000000); - return (manufacturer == FLASH_MANUFACTURER && (devtype == FLASH_DEVICE_16mbit_TOP || FLASH_DEVICE_16mbit_BOTTOM)); + return (manufacturer == FLASH_MANUFACTURER && (devtype == FLASH_DEVICE_16mbit_TOP || devtype == FLASH_DEVICE_16mbit_BOTTOM)); } /* -- cgit v1.1 From 53fb84a0695ffeeeadf8ae92db28cbccf5325531 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Mon, 4 Feb 2008 23:44:47 -0800 Subject: [MTD] [DOC200x] eccbuf is statically defined and always evaluate to true Signed-off-by: Samuel Tardieu Acked-by: Joern Engel Signed-off-by: Andrew Morton Signed-off-by: David Woodhouse --- drivers/mtd/devices/doc2000.c | 4 ++-- drivers/mtd/devices/doc2001plus.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/mtd/devices') diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c index c73e96b..e9ce241 100644 --- a/drivers/mtd/devices/doc2000.c +++ b/drivers/mtd/devices/doc2000.c @@ -632,7 +632,7 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, len = ((from | 0x1ff) + 1) - from; /* The ECC will not be calculated correctly if less than 512 is read */ - if (len != 0x200 && eccbuf) + if (len != 0x200) printk(KERN_WARNING "ECC needs a full sector read (adr: %lx size %lx)\n", (long) from, (long) len); @@ -896,7 +896,7 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, /* Let the caller know we completed it */ *retlen += len; - if (eccbuf) { + { unsigned char x[8]; size_t dummy; int ret; diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c index 2b30b58..83be346 100644 --- a/drivers/mtd/devices/doc2001plus.c +++ b/drivers/mtd/devices/doc2001plus.c @@ -748,7 +748,7 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, WriteDOC(DoC_GetDataOffset(mtd, &fto), docptr, Mplus_FlashCmd); /* On interleaved devices the flags for 2nd half 512 are before data */ - if (eccbuf && before) + if (before) fto -= 2; /* issue the Serial Data In command to initial the Page Program process */ -- cgit v1.1