[PATCH] mtd: docg3: fix max_bitflips related bug

Mike Dunn mikedunn at newsguy.com
Tue May 1 13:25:25 EDT 2012


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 at newsguy.com>
Acked-by: Robert Jarzmik <robert.jarzmik at free.fr>
---
 drivers/mtd/devices/docg3.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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);
-- 
1.7.3.4




More information about the linux-mtd mailing list