Skip to content

Commit

Permalink
[MTD] [NAND] treat any negative return value from correct() as an error
Browse files Browse the repository at this point in the history
Treat any negative return value from a NAND driver's correct() function
as a failure, rather than just -1.

Signed-off-by: Matt Reimer <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
matthewreimer authored and dwmw2 committed Oct 20, 2007
1 parent 39e73fc commit c32b8dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
int stat;

stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
if (stat == -1)
if (stat < 0)
mtd->ecc_stats.failed++;
else
mtd->ecc_stats.corrected += stat;
Expand Down Expand Up @@ -833,7 +833,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
int stat;

stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
if (stat == -1)
if (stat < 0)
mtd->ecc_stats.failed++;
else
mtd->ecc_stats.corrected += stat;
Expand Down Expand Up @@ -874,7 +874,7 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
chip->read_buf(mtd, oob, eccbytes);
stat = chip->ecc.correct(mtd, p, oob, NULL);

if (stat == -1)
if (stat < 0)
mtd->ecc_stats.failed++;
else
mtd->ecc_stats.corrected += stat;
Expand Down

0 comments on commit c32b8dc

Please sign in to comment.