]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: nand: relax ecc.read_page() return value for uncorrectable ECC
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 30 Mar 2017 06:45:47 +0000 (15:45 +0900)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 25 Apr 2017 12:18:31 +0000 (14:18 +0200)
commit77efac3558a47b8dd6775065b639bd8eddaa4a7d
treecf462396e69f6c7a61dead633765e555deaf6de4
parent455357aebe8151b84a31ddd77afc3a9b2e46ca33
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>
drivers/mtd/nand/nand_base.c
include/linux/mtd/nand.h