mtd: vf610_nfc: allow bitflips in an empty page
authorStefan Agner <stefan@agner.ch>
Tue, 7 Apr 2015 15:07:07 +0000 (17:07 +0200)
committerStefan Agner <stefan@agner.ch>
Tue, 14 Apr 2015 07:08:07 +0000 (09:08 +0200)
Allow bit flips in a empty page up to half of the recoverable
bits (strength / 2).

drivers/mtd/nand/vf610_nfc.c

index 66b335d00825c709719170b2bc7ca902877c126a..16485f5713e9b62f5ec546ddc472a4241a1626be 100644 (file)
@@ -527,7 +527,7 @@ static inline int vf610_nfc_correct_data(struct mtd_info *mtd, u_char *dat)
        flip = count_written_bits(dat, nfc->chip.ecc.size, ecc_count);
 
        /* ECC failed. */
-       if (flip > ecc_count)
+       if (flip > ecc_count && flip > (nfc->chip.ecc.strength / 2))
                return -1;
 
        /* Erased page. */