mtd: docg4: ecc.read_page() returns 0 on uncorrectable errors

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Sep 29 10:59:51 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=5bf3d66a933efb71fa6db08a5043a617b6eadb4a
Commit:     5bf3d66a933efb71fa6db08a5043a617b6eadb4a
Parent:     61de9da657e8c52606d45ae67dfa187111bf9b55
Author:     Mike Dunn <mikedunn at newsguy.com>
AuthorDate: Tue Sep 11 08:50:50 2012 -0700
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sat Sep 29 15:54:11 2012 +0100

    mtd: docg4: ecc.read_page() returns 0 on uncorrectable errors
    
    Currently the docg4's ecc.read_page() method returns -EBADMSG when
    uncorrectable bitflips occur.  This is wrong; 0 should be returned in
    this case.  An error code should only be returned by this method in the
    case of a hardware error (probably -EIO).
    
    Signed-off-by: Mike Dunn <mikedunn at newsguy.com>
    Acked-by: Brian Norris <computersforpeace at gmail.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/docg4.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
index 793921e..799da5d 100644
--- a/drivers/mtd/nand/docg4.c
+++ b/drivers/mtd/nand/docg4.c
@@ -776,6 +776,8 @@ static int read_page(struct mtd_info *mtd, struct nand_chip *nand,
 	}
 
 	writew(0, docptr + DOC_DATAEND);
+	if (bits_corrected == -EBADMSG)	  /* uncorrectable errors */
+		return 0;
 	return bits_corrected;
 }
 



More information about the linux-mtd-cvs mailing list