public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Brian Norris" <computersforpeace@gmail.com>
To: "Artem Bityutskiy" <dedekind1@gmail.com>
Cc: Jim Quinlan <jim2101024@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org,
	Kevin Cernekee <cernekee@gmail.com>
Subject: [PATCH 1/3] mtd: nand: ignore ECC errors for simple BBM scans
Date: Tue, 28 Jun 2011 16:28:58 -0700	[thread overview]
Message-ID: <1309303740-9936-2-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1309303740-9936-1-git-send-email-computersforpeace@gmail.com>

Now that nand_do_readoob() may return -EUCLEAN or -EBADMSG on ECC errors,
we need to handle the return value specially in some cases.

When scanning for simple bad block markers, reacting to an ECC error is
not very useful, as we assume that the relevant markers are still
non-0xFF for true bad blocks.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/mtd/nand/nand_bbt.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index f30807c..a4fcbf1 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -312,14 +312,20 @@ static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
 			ops.oobbuf = buf + len;
 			ops.datbuf = buf;
 			ops.len = len;
-			return mtd->read_oob(mtd, offs, &ops);
+			res = mtd->read_oob(mtd, offs, &ops);
+
+			/* Ignore ECC errors when checking for BBM */
+			if (res != -EUCLEAN && res != -EBADMSG)
+				return res;
+			return 0;
 		} else {
 			ops.oobbuf = buf + mtd->writesize;
 			ops.datbuf = buf;
 			ops.len = mtd->writesize;
 			res = mtd->read_oob(mtd, offs, &ops);
 
-			if (res)
+			/* Ignore ECC errors when checking for BBM */
+			if (res && res != -EUCLEAN && res != -EBADMSG)
 				return res;
 		}
 
@@ -435,7 +441,8 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd,
 		 * byte reads for 16 bit buswidth.
 		 */
 		ret = mtd->read_oob(mtd, offs, &ops);
-		if (ret)
+		/* Ignore ECC errors when checking for BBM */
+		if (ret && ret != -EUCLEAN && ret != -EBADMSG)
 			return ret;
 
 		if (check_short_pattern(buf, bd))
-- 
1.7.0.4

  reply	other threads:[~2011-06-28 23:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-28 23:28 [PATCH 0/3] fixups for OOB ECC problems Brian Norris
2011-06-28 23:28 ` Brian Norris [this message]
2011-06-29  7:02   ` [PATCH 1/3] mtd: nand: ignore ECC errors for simple BBM scans Artem Bityutskiy
2011-06-28 23:28 ` [PATCH 2/3] mtd: tests: ignore corrected bitflips in OOB on mtd_readtest Brian Norris
2011-06-28 23:29 ` [PATCH 3/3] mtd: edit NAND-related comment Brian Norris
2011-06-29  6:59 ` [PATCH 0/3] fixups for OOB ECC problems Artem Bityutskiy
2011-06-29 20:24   ` Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309303740-9936-2-git-send-email-computersforpeace@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=cernekee@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=jim2101024@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox