[PATCHJ] [MTD] [OneNAND] Allow for controller errors when reading
Adrian Hunter
ext-adrian.hunter at nokia.com
Fri Apr 11 07:05:15 EDT 2008
Controller errors while reading can be caused by
corruption caused by a previous powerloss. Because
upper level software like JFFS2 treat -EIO as fatal,
it is necessary to treat the error as an ECC error.
Signed-off-by: Adrian Hunter <ext-adrian.hunter at nokia.com>
---
drivers/mtd/onenand/onenand_base.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 15a62db..daf1965 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -329,6 +329,16 @@ static int onenand_wait(struct mtd_info *mtd, int state)
printk(KERN_ERR "onenand_wait: controller error = 0x%04x\n", ctrl);
if (ctrl & ONENAND_CTRL_LOCK)
printk(KERN_ERR "onenand_wait: it's locked error.\n");
+ if (state == FL_READING) {
+ /*
+ * Controller errors while reading can be caused by
+ * corruption caused by a previous powerloss. Because
+ * upper level software like JFFS2 treat -EIO as fatal,
+ * it is necessary to treat the error as an ECC error.
+ */
+ mtd->ecc_stats.failed++;
+ return -EBADMSG;
+ }
return -EIO;
}
--
1.5.2.5
More information about the linux-mtd
mailing list