diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-03-30 02:45:47 -0400 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2017-04-25 08:18:31 -0400 |
commit | 07604686e808cd93d352172806a7828860f048f5 (patch) | |
tree | cf462396e69f6c7a61dead633765e555deaf6de4 /drivers/mtd/nand | |
parent | f107d7a43923a83d837b3ea3c7b7de58cd014bbd (diff) |
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 <yamada.masahiro@socionext.com>
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 36258e69a389..de6c8045c85b 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -1993,8 +1993,6 @@ read_retry: | |||
1993 | break; | 1993 | break; |
1994 | } | 1994 | } |
1995 | 1995 | ||
1996 | max_bitflips = max_t(unsigned int, max_bitflips, ret); | ||
1997 | |||
1998 | /* Transfer not aligned data */ | 1996 | /* Transfer not aligned data */ |
1999 | if (use_bufpoi) { | 1997 | if (use_bufpoi) { |
2000 | if (!NAND_HAS_SUBPAGE_READ(chip) && !oob && | 1998 | if (!NAND_HAS_SUBPAGE_READ(chip) && !oob && |
@@ -2045,6 +2043,7 @@ read_retry: | |||
2045 | } | 2043 | } |
2046 | 2044 | ||
2047 | buf += bytes; | 2045 | buf += bytes; |
2046 | max_bitflips = max_t(unsigned int, max_bitflips, ret); | ||
2048 | } else { | 2047 | } else { |
2049 | memcpy(buf, chip->buffers->databuf + col, bytes); | 2048 | memcpy(buf, chip->buffers->databuf + col, bytes); |
2050 | buf += bytes; | 2049 | buf += bytes; |