mtd: fix callback return value check

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Oct 24 20:59:02 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=12c8eb98de747ebc08404e3719c40abb405994e2
Commit:     12c8eb98de747ebc08404e3719c40abb405994e2
Parent:     899611ee7d373e5eeda08e9a8632684e1ebbbf00
Author:     Baruch Siach <baruch at tkos.co.il>
AuthorDate: Mon Aug 9 07:20:23 2010 +0300
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sun Oct 24 23:26:13 2010 +0100

    mtd: fix callback return value check
    
    Drivers may (and do) return negative errno values other than -1 from the
    ecc.correct callback.
    
    Signed-off-by: Baruch Siach <baruch at tkos.co.il>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/nand_base.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d551ddd..0fd22cc 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -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;



More information about the linux-mtd-cvs mailing list