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

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Nov 28 06:59:14 EST 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=cccb45d4b34728d33638085435f8fdc0a83e0c00
Commit:     cccb45d4b34728d33638085435f8fdc0a83e0c00
Parent:     c2056e1e1ddcca8d43e89543e1795e4457f5d1e9
Author:     Andrew Victor <andrew at sanpeople.com>
AuthorDate: Mon Nov 19 15:37:23 2007 +0200
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Wed Nov 28 11:55:32 2007 +0000

    [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 <andrew at sanpeople.com>
    Acked-by: David Brownell <david-b at pacbell.net>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/devices/mtd_dataflash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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;



More information about the linux-mtd-cvs mailing list