mtd: nand: relax ecc.read_page() return value for uncorrectable ECC

The comment for ecc.read_page() requires that it should return
"0 if bitflips uncorrectable".

Actually, drivers could return positive values when uncorrectable
bitflips occur.  For example, nand_read_page_swecc() is the case.
If ecc.correct() returns -EBADMSG for the first ECC sector, and
a positive value for the second one, nand_read_page_swecc() returns
a positive max_bitflips and increments ecc_stats.failed for the same
page.

The requirement can be relaxed by tweaking nand_do_read_ops().
Move the max_bitflips calculation below the retry.

Signed-off-by: Masahiro Yamada <[email protected]>
Suggested-by: Boris Brezillon <[email protected]>
Signed-off-by: Boris Brezillon <[email protected]>
This commit is contained in:
Masahiro Yamada 2017-03-30 15:45:47 +09:00 • committed by Boris Brezillon
commit 07604686e8
2 changed files with 2 additions and 3 deletions

View file

@ -1993,8 +1993,6 @@ read_retry:
break;
}
max_bitflips = max_t(unsigned int, max_bitflips, ret);
/* Transfer not aligned data */
if (use_bufpoi) {
if (!NAND_HAS_SUBPAGE_READ(chip) && !oob &&
@ -2045,6 +2043,7 @@ read_retry:
}
buf += bytes;
max_bitflips = max_t(unsigned int, max_bitflips, ret);
} else {
memcpy(buf, chip->buffers->databuf + col, bytes);
buf += bytes;