Patchwork [v2] mtd: nand: docg4: ecc.read_page() returns 0 on uncorrectable errors

login
register
mail settings
Submitter Mike Dunn
Date Sept. 15, 2012, 7:26 p.m.
Message ID <1347737205-17019-1-git-send-email-mikedunn@newsguy.com>
Download mbox | patch
Permalink /patch/184097/
State New
Headers show

Comments

Mike Dunn - Sept. 15, 2012, 7:26 p.m.
v2 fixes spelling error

Currently the docg4's ecc.read_page() method returns -EBADMSG when uncorrectible
bitflips occur.  This is wrong; 0 should be returned in this case.  An error
code should only be returned by this method in the case of a hardware error
(probably -EIO).

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/mtd/nand/docg4.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
index 793921e..deb718c 100644
--- a/drivers/mtd/nand/docg4.c
+++ b/drivers/mtd/nand/docg4.c
@@ -776,6 +776,8 @@  static int read_page(struct mtd_info *mtd, struct nand_chip *nand,
 	}
 
 	writew(0, docptr + DOC_DATAEND);
+	if (bits_corrected == -EBADMSG)	  /* uncorrectable errors */
+		return 0;
 	return bits_corrected;
 }