diff options
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index c9767b511dfe..51653d9e1438 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -1479,14 +1479,22 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, | |||
1479 | else | 1479 | else |
1480 | ret = chip->ecc.read_page(mtd, chip, bufpoi, | 1480 | ret = chip->ecc.read_page(mtd, chip, bufpoi, |
1481 | page); | 1481 | page); |
1482 | if (ret < 0) | 1482 | if (ret < 0) { |
1483 | if (!aligned) | ||
1484 | /* Invalidate page cache */ | ||
1485 | chip->pagebuf = -1; | ||
1483 | break; | 1486 | break; |
1487 | } | ||
1484 | 1488 | ||
1485 | /* Transfer not aligned data */ | 1489 | /* Transfer not aligned data */ |
1486 | if (!aligned) { | 1490 | if (!aligned) { |
1487 | if (!NAND_SUBPAGE_READ(chip) && !oob && | 1491 | if (!NAND_SUBPAGE_READ(chip) && !oob && |
1488 | !(mtd->ecc_stats.failed - stats.failed)) | 1492 | !(mtd->ecc_stats.failed - stats.failed) && |
1493 | (ops->mode != MTD_OPS_RAW)) | ||
1489 | chip->pagebuf = realpage; | 1494 | chip->pagebuf = realpage; |
1495 | else | ||
1496 | /* Invalidate page cache */ | ||
1497 | chip->pagebuf = -1; | ||
1490 | memcpy(buf, chip->buffers->databuf + col, bytes); | 1498 | memcpy(buf, chip->buffers->databuf + col, bytes); |
1491 | } | 1499 | } |
1492 | 1500 | ||