Skip to content

Commit

Permalink
mtd: fix callback return value check
Browse files Browse the repository at this point in the history
Drivers may (and do) return negative errno values other than -1 from the
ecc.correct callback.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Baruch Siach authored and David Woodhouse committed Oct 24, 2010
1 parent 899611e commit 12c8eb9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint3
int stat;

stat = chip->ecc.correct(mtd, p, &chip->buffers->ecccode[i], &chip->buffers->ecccalc[i]);
if (stat == -1)
if (stat < 0)
mtd->ecc_stats.failed++;
else
mtd->ecc_stats.corrected += stat;
Expand Down

0 comments on commit 12c8eb9

Please sign in to comment.