]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mtd: nand: sunxi: fix bitflips in erased pages
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Wed, 30 Sep 2015 21:45:29 +0000 (23:45 +0200)
committerBrian Norris <computersforpeace@gmail.com>
Fri, 2 Oct 2015 18:09:51 +0000 (11:09 -0700)
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@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/sunxi_nand.c

index a76eb5173bb82de968f2f423800c4c8b89f93ecc..92245a31233457ad5778bdd0090ab17982580c40 100644 (file)
@@ -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.