mtd: nand: sunxi: fix bitflips in erased pages

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Nov 6 10:59:10 PST 2015


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=146b503e102778ee98d8ba59e9e178ab26a4af5b
Commit:     146b503e102778ee98d8ba59e9e178ab26a4af5b
Parent:     23151fd6138a3959628ea093237ca3f9d597e155
Author:     Boris BREZILLON <boris.brezillon at free-electrons.com>
AuthorDate: Wed Sep 30 23:45:29 2015 +0200
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Oct 2 11:09:51 2015 -0700

    mtd: nand: sunxi: fix bitflips in erased pages
    
    Use the nand_check_erased_ecc_chunk() function to test if the ECC error
    was triggered by an erased page containing a few bitflips.
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/sunxi_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index a76eb51..92245a3 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -611,7 +611,9 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,
 	sunxi_nfc_read_buf(mtd, oob, ecc->bytes + 4);
 
 	if (status & NFC_ECC_ERR(0)) {
-		ret = -EIO;
+		ret = nand_check_erased_ecc_chunk(data,	ecc->size,
+						  oob, ecc->bytes + 4,
+						  NULL, 0, ecc->strength);
 	} else {
 		/*
 		 * The engine protects 4 bytes of OOB data per chunk.



More information about the linux-mtd-cvs mailing list