Skip to content

Commit 6cbefbd

Browse files
saschahauerBoris Brezillon
authored andcommitted
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>
1 parent f953f0f commit 6cbefbd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/mtd/tests/nandbiterrs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static int read_page(int log)
151151
memcpy(&oldstats, &mtd->ecc_stats, sizeof(oldstats));
152152

153153
err = mtd_read(mtd, offset, mtd->writesize, &read, rbuffer);
154-
if (err == -EUCLEAN)
154+
if (!err || err == -EUCLEAN)
155155
err = mtd->ecc_stats.corrected - oldstats.corrected;
156156

157157
if (err < 0 || read != mtd->writesize) {

0 commit comments

Comments
 (0)