* [PATCH v2] mtd: nand: fix off-by-one read retry mode counting
@ 2014-02-13 1:22 Brian Norris
2014-02-14 7:58 ` Huang Shijie
0 siblings, 1 reply; 3+ messages in thread
From: Brian Norris @ 2014-02-13 1:22 UTC (permalink / raw)
To: linux-mtd; +Cc: Huang Shijie, Brian Norris
A flash may support N read retry voltage threshold modes, numbered 1
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>
---
v1 -> v2: N modes means we should use modes 0 to N-1, not 0 to N
drivers/mtd/nand/nand_base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 9be7842f300e..3cb1cefcd926 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1586,7 +1586,7 @@ read_retry:
}
if (mtd->ecc_stats.failed - ecc_failures) {
- if (retry_mode + 1 <= chip->read_retries) {
+ if (retry_mode + 1 < chip->read_retries) {
retry_mode++;
ret = nand_setup_read_retry(mtd,
retry_mode);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mtd: nand: fix off-by-one read retry mode counting
2014-02-13 1:22 [PATCH v2] mtd: nand: fix off-by-one read retry mode counting Brian Norris
@ 2014-02-14 7:58 ` Huang Shijie
2014-02-14 20:15 ` Brian Norris
0 siblings, 1 reply; 3+ messages in thread
From: Huang Shijie @ 2014-02-14 7:58 UTC (permalink / raw)
To: Brian Norris; +Cc: linux-mtd
On Wed, Feb 12, 2014 at 05:22:11PM -0800, Brian Norris wrote:
> A flash may support N read retry voltage threshold modes, numbered 1
> 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>
> ---
> v1 -> v2: N modes means we should use modes 0 to N-1, not 0 to N
>
> drivers/mtd/nand/nand_base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 9be7842f300e..3cb1cefcd926 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -1586,7 +1586,7 @@ read_retry:
> }
>
> if (mtd->ecc_stats.failed - ecc_failures) {
> - if (retry_mode + 1 <= chip->read_retries) {
> + if (retry_mode + 1 < chip->read_retries) {
> retry_mode++;
> ret = nand_setup_read_retry(mtd,
> retry_mode);
> --
> 1.8.3.2
>
>
>
Acked-by: Huang Shijie <b32955@freescale.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mtd: nand: fix off-by-one read retry mode counting
2014-02-14 7:58 ` Huang Shijie
@ 2014-02-14 20:15 ` Brian Norris
0 siblings, 0 replies; 3+ messages in thread
From: Brian Norris @ 2014-02-14 20:15 UTC (permalink / raw)
To: Huang Shijie; +Cc: linux-mtd
On Fri, Feb 14, 2014 at 03:58:21PM +0800, Huang Shijie wrote:
> On Wed, Feb 12, 2014 at 05:22:11PM -0800, Brian Norris wrote:
> > A flash may support N read retry voltage threshold modes, numbered 1
> > 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>
> > ---
> > v1 -> v2: N modes means we should use modes 0 to N-1, not 0 to N
> >
> > drivers/mtd/nand/nand_base.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> > index 9be7842f300e..3cb1cefcd926 100644
> > --- a/drivers/mtd/nand/nand_base.c
> > +++ b/drivers/mtd/nand/nand_base.c
> > @@ -1586,7 +1586,7 @@ read_retry:
> > }
> >
> > if (mtd->ecc_stats.failed - ecc_failures) {
> > - if (retry_mode + 1 <= chip->read_retries) {
> > + if (retry_mode + 1 < chip->read_retries) {
> > retry_mode++;
> > ret = nand_setup_read_retry(mtd,
> > retry_mode);
>
> Acked-by: Huang Shijie <b32955@freescale.com>
Pushed to linux-mtd.git. Will queue up a few other things to send to
Linus in 3.14-rcX.
Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-14 20:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13 1:22 [PATCH v2] mtd: nand: fix off-by-one read retry mode counting Brian Norris
2014-02-14 7:58 ` Huang Shijie
2014-02-14 20:15 ` Brian Norris
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.