aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2014-02-12 19:08:28 -0500
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:57:47 -0400
commit0862fa1a3445f5a83f68d2d2ecf523c5fcda3ab7 (patch)
tree9cbe6a5f484da0b43d52a7c6068d2f2258181908
parent8615ad64d1bf43a7952d490dbfe729b45a388d52 (diff)
mtd: nand: fix off-by-one read retry mode counting
A flash may support N read retry voltage threshold modes, numbered 0 through N-1 (where mode 0 represents the initial state). However, nand_do_read_ops() tries to use mode 0 through N. This off-by-one error shows up, for instance, when using nanddump, and we have cycled through available modes: nand: setting READ RETRY mode 0 nand: setting READ RETRY mode 1 nand: setting READ RETRY mode 2 nand: setting READ RETRY mode 3 nand: setting READ RETRY mode 4 nand: setting READ RETRY mode 5 nand: setting READ RETRY mode 6 nand: setting READ RETRY mode 7 nand: setting READ RETRY mode 8 libmtd: error!: cannot read 8192 bytes from mtd0 (eraseblock 20, offset 0) error 22 (Invalid argument) nanddump: error!: mtd_read Tested on Micron MT29F64G08CBCBBH1, with 8 retry modes. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Huang Shijie <b32955@freescale.com>
-rw-r--r--drivers/mtd/nand/nand_base.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c78ec5f60102..c27ff0a9d650 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1586,7 +1586,7 @@ read_retry:
1586 } 1586 }
1587 1587
1588 if (mtd->ecc_stats.failed - ecc_failures) { 1588 if (mtd->ecc_stats.failed - ecc_failures) {
1589 if (retry_mode + 1 <= chip->read_retries) { 1589 if (retry_mode + 1 < chip->read_retries) {
1590 retry_mode++; 1590 retry_mode++;
1591 ret = nand_setup_read_retry(mtd, 1591 ret = nand_setup_read_retry(mtd,
1592 retry_mode); 1592 retry_mode);