[MTD] [NAND] treat any negative return value from correct() as an error

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Oct 20 17:59:01 EDT 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=c32b8dcc45c823cf30dcdf0fc37ee2f6b78f38cb
Commit:     c32b8dcc45c823cf30dcdf0fc37ee2f6b78f38cb
Parent:     39e73fc10e916db93c8a2c622f0315d296e66cf4
Author:     Matt Reimer <mreimer at vpop.net>
AuthorDate: Wed Oct 17 14:33:23 2007 -0700
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Sat Oct 20 22:27:22 2007 +0100

    [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: Matt Reimer <mreimer at vpop.net>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/nand/nand_base.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

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



More information about the linux-mtd-cvs mailing list