Commit c32b8dcc authored by Matt Reimer's avatar Matt Reimer Committed by David Woodhouse

[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: default avatarMatt Reimer <mreimer@vpop.net>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 39e73fc1
...@@ -789,7 +789,7 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -789,7 +789,7 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
int stat; int stat;
stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
if (stat == -1) if (stat < 0)
mtd->ecc_stats.failed++; mtd->ecc_stats.failed++;
else else
mtd->ecc_stats.corrected += stat; mtd->ecc_stats.corrected += stat;
...@@ -833,7 +833,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -833,7 +833,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
int stat; int stat;
stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]); stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
if (stat == -1) if (stat < 0)
mtd->ecc_stats.failed++; mtd->ecc_stats.failed++;
else else
mtd->ecc_stats.corrected += stat; mtd->ecc_stats.corrected += stat;
...@@ -874,7 +874,7 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -874,7 +874,7 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
chip->read_buf(mtd, oob, eccbytes); chip->read_buf(mtd, oob, eccbytes);
stat = chip->ecc.correct(mtd, p, oob, NULL); stat = chip->ecc.correct(mtd, p, oob, NULL);
if (stat == -1) if (stat < 0)
mtd->ecc_stats.failed++; mtd->ecc_stats.failed++;
else else
mtd->ecc_stats.corrected += stat; mtd->ecc_stats.corrected += stat;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment