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>
        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.