[PATCH] [MTD] mtd_dataflash: Incorrect compare-after-write check

Andrew Victor andrew at sanpeople.com
Mon Nov 19 08:37:23 EST 2007


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 <andrew at sanpeople.com>
Acked-by: David Brownell <david-b at pacbell.net>


diff -urN -x CVS linux-2.6.24-rc3/drivers/mtd/devices/mtd_dataflash.c linux-2.6-stable/drivers/mtd/devices/mtd_dataflash.c
--- linux-2.6.24-rc3/drivers/mtd/devices/mtd_dataflash.c	Mon Nov 19 11:31:10 2007
+++ linux-2.6-stable/drivers/mtd/devices/mtd_dataflash.c	Tue Nov 13 15:52:02 2007
@@ -420,7 +420,7 @@
 		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;






More information about the linux-mtd mailing list