Patchwork mtd: docg3: fix max_bitflips related bug

login
register
mail settings
Submitter Mike Dunn
Date May 1, 2012, 5:25 p.m.
Message ID <1335893125-15904-1-git-send-email-mikedunn@newsguy.com>
Download mbox | patch
Permalink /patch/156152/
State New
Headers show

Comments

Mike Dunn - May 1, 2012, 5:25 p.m.
This fixes a bug in the docg3 driver that was introduced by the EUCLEAN patch
set [1].

[1] http://lists.infradead.org/pipermail/linux-mtd/2012-April/040941.html

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/mtd/devices/docg3.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Artem Bityutskiy - May 2, 2012, 12:13 p.m.
On Tue, 2012-05-01 at 10:25 -0700, Mike Dunn wrote:
> This fixes a bug in the docg3 driver that was introduced by the EUCLEAN patch
> set [1].
> 
> [1] http://lists.infradead.org/pipermail/linux-mtd/2012-April/040941.html
> 
> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>

Folded this patch into:

mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN

and pushed to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 7644d59..3dbbfa5 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -889,7 +889,7 @@  static int doc_read_oob(struct mtd_info *mtd, loff_t from,
 	ret = 0;
 	skip = from % DOC_LAYOUT_PAGE_SIZE;
 	mutex_lock(&docg3->cascade->lock);
-	while (!ret && (len > 0 || ooblen > 0)) {
+	while (ret >= 0 && (len > 0 || ooblen > 0)) {
 		calc_block_sector(from - skip, &block0, &block1, &page, &ofs,
 			docg3->reliable);
 		nbdata = min_t(size_t, len, DOC_LAYOUT_PAGE_SIZE - skip);