mtd: fix callback return value check
authorBaruch Siach <baruch@tkos.co.il>
Mon, 9 Aug 2010 04:20:23 +0000 (07:20 +0300)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sun, 24 Oct 2010 22:26:13 +0000 (23:26 +0100)
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>
drivers/mtd/nand/nand_base.c

index d551ddd9537a34d17fe3c13b7604855fc5c06f5b..0fd22cce0eccd7f4c7534b394447410f7ecbd7b4 100644 (file)
@@ -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;