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

Andrew Victor andrew at sanpeople.com
Thu Aug 23 10:45:48 EDT 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.23-rc3/drivers/mtd/devices/mtd_dataflash.c linux-2.6-stable/drivers/mtd/devices/mtd_dataflash.c
--- linux-2.6.23-rc3/drivers/mtd/devices/mtd_dataflash.c	Thu Apr 26 05:08:32 2007
+++ linux-2.6-stable/drivers/mtd/devices/mtd_dataflash.c	Wed Aug 22 14:43:06 2007
@@ -419,7 +419,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