aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-09-03 15:01:16 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 19:13:34 -0400
commitc1194c793240330ce59500d67737e3f28b4bde40 (patch)
tree73cdbcc7dc7decf45b4903ade3235bb18248b4c2 /drivers/mtd
parentbc49c28962de0e3758ac2cdc7821d506b827f219 (diff)
mtd: nand_base: do not cache pages with uncorrectable ECC errors
Currently MTD caches the last read NAND page, even if there was an uncorrectable ECC error. This patch prevents caching in case of uncorrectable ECC errors. The reason is that we want to allow the user to re-read the NAND page several times. In case of unstable bits re-trying may help. Moreover, current behavior is wrong because the first read returns -EBADMSG (correctly) but the second read succeeds and incorrectly returns 0 (because we read from the cache). Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_base.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 922b890c8fcb..0b70c175999c 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1505,7 +1505,8 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
1505 1505
1506 /* Transfer not aligned data */ 1506 /* Transfer not aligned data */
1507 if (!aligned) { 1507 if (!aligned) {
1508 if (!NAND_SUBPAGE_READ(chip) && !oob) 1508 if (!NAND_SUBPAGE_READ(chip) && !oob &&
1509 !(mtd->ecc_stats.failed - stats.failed))
1509 chip->pagebuf = realpage; 1510 chip->pagebuf = realpage;
1510 memcpy(buf, chip->buffers->databuf + col, bytes); 1511 memcpy(buf, chip->buffers->databuf + col, bytes);
1511 } 1512 }