summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-01-09 12:47:02 +0300
committerBoris Brezillon <boris.brezillon@free-electrons.com>2018-01-09 12:56:29 +0300
commit6cbefbdcec41bf725b308288dcb200a6efc3339f (patch)
tree7440eab03302122ba2162db40e0be3405a8f2c13
parentf953f0f89663c39f08f4baaa8a4a881401b65654 (diff)
downloadlinux-6cbefbdcec41bf725b308288dcb200a6efc3339f.tar.xz
mtd: tests: nandbiterrs: Fix read_page return value
The number of corrected bitflips is not correctly reported by the test until the bitflip threshold is reached. read_page() shall return the number of corrected bitflips, but mtd_read() returns 0 or a negative error, so we can't forward its return value. In the absence of an error we always have calculate the number of bitflips ourselves. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
-rw-r--r--drivers/mtd/tests/nandbiterrs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/tests/nandbiterrs.c b/drivers/mtd/tests/nandbiterrs.c
index 5f03b8c885a9..cde19c99e77b 100644
--- a/drivers/mtd/tests/nandbiterrs.c
+++ b/drivers/mtd/tests/nandbiterrs.c
@@ -151,7 +151,7 @@ static int read_page(int log)
memcpy(&oldstats, &mtd->ecc_stats, sizeof(oldstats));
err = mtd_read(mtd, offset, mtd->writesize, &read, rbuffer);
- if (err == -EUCLEAN)
+ if (!err || err == -EUCLEAN)
err = mtd->ecc_stats.corrected - oldstats.corrected;
if (err < 0 || read != mtd->writesize) {