Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MTD] [NAND] treat any negative return value from correct() as an error

Treat any negative return value from a NAND driver's correct() function
as a failure, rather than just -1.

Signed-off-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>

authored by

Matt Reimer and committed by
David Woodhouse
c32b8dcc 39e73fc1

+3 -3
+3 -3
drivers/mtd/nand/nand_base.c
··· 789 789 int stat; 790 790 791 791 stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); 792 - if (stat == -1) 792 + if (stat < 0) 793 793 mtd->ecc_stats.failed++; 794 794 else 795 795 mtd->ecc_stats.corrected += stat; ··· 833 833 int stat; 834 834 835 835 stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); 836 - if (stat == -1) 836 + if (stat < 0) 837 837 mtd->ecc_stats.failed++; 838 838 else 839 839 mtd->ecc_stats.corrected += stat; ··· 874 874 chip->read_buf(mtd, oob, eccbytes); 875 875 stat = chip->ecc.correct(mtd, p, oob, NULL); 876 876 877 - if (stat == -1) 877 + if (stat < 0) 878 878 mtd->ecc_stats.failed++; 879 879 else 880 880 mtd->ecc_stats.corrected += stat;