diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 56255c85d97b..5d7965f7e9ce 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c | |||
@@ -329,6 +329,21 @@ static int onenand_wait(struct mtd_info *mtd, int state) | |||
329 | printk(KERN_ERR "onenand_wait: controller error = 0x%04x\n", ctrl); | 329 | printk(KERN_ERR "onenand_wait: controller error = 0x%04x\n", ctrl); |
330 | if (ctrl & ONENAND_CTRL_LOCK) | 330 | if (ctrl & ONENAND_CTRL_LOCK) |
331 | printk(KERN_ERR "onenand_wait: it's locked error.\n"); | 331 | printk(KERN_ERR "onenand_wait: it's locked error.\n"); |
332 | if (state == FL_READING) { | ||
333 | /* | ||
334 | * A power loss while writing can result in a page | ||
335 | * becoming unreadable. When the device is mounted | ||
336 | * again, reading that page gives controller errors. | ||
337 | * Upper level software like JFFS2 treat -EIO as fatal, | ||
338 | * refusing to mount at all. That means it is necessary | ||
339 | * to treat the error as an ECC error to allow recovery. | ||
340 | * Note that typically in this case, the eraseblock can | ||
341 | * still be erased and rewritten i.e. it has not become | ||
342 | * a bad block. | ||
343 | */ | ||
344 | mtd->ecc_stats.failed++; | ||
345 | return -EBADMSG; | ||
346 | } | ||
332 | return -EIO; | 347 | return -EIO; |
333 | } | 348 | } |
334 | 349 | ||