public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Kyungmin Park <kyungmin.park@samsung.com>
To: Adrian Hunter <hunter.programmer@gmail.com>,
	linux-mtd <linux-mtd@lists.infradead.org>
Subject: onenand_wait and onenane_read
Date: Fri, 29 Dec 2006 03:19:37 +0000 (GMT)	[thread overview]
Message-ID: <31762214.867031167362377345.JavaMail.weblogic@ep_ml28> (raw)


Hi,

> onenand_wait does not return an error if there is an ecc failure i.e.
> 
> ecc & ONENAND_ECC_2BIT_ALL
> 
> but onenand_read still marks the bufferRAM as valid i.e.
> 
> ret = this->wait(mtd, FL_READING);
> /* First copy data and check return value for ECC handling */
> onenand_update_bufferram(mtd, from, !ret);
> 
> This looks wrong to me.  I think onenand_wait should return an error
> if there is an ecc failure.

Yes you're right.

Even though upper layer (JFFS2) receive the -EBADMSG or -EUCLEAN, OneNAND driver can think it is valid data.

Thank you,
Kyungmin Park

From 9235da2851242b96a938d43583bf88427ed14044 Mon Sep 17 00:00:00 2001
From: Kyungmin Park <kyungmin.park@samsung.com>
Date: Fri, 29 Dec 2006 11:51:40 +0900
Subject: [PATCH] [MTD] OneNAND: fix onenand_wait bug in read ecc error

Even though there is ECC error. OneNAND driver updates the bufferram as valid

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mtd/onenand/onenand_base.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 0037cee..e80857b 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -298,7 +298,7 @@ static int onenand_wait(struct mtd_info *mtd, int state)
 	unsigned long timeout;
 	unsigned int flags = ONENAND_INT_MASTER;
 	unsigned int interrupt = 0;
-	unsigned int ctrl, ecc;
+	unsigned int ctrl;
 
 	/* The 20 msec is enough */
 	timeout = jiffies + msecs_to_jiffies(20);
@@ -324,7 +324,7 @@ static int onenand_wait(struct mtd_info *mtd, int state)
 	}
 
 	if (interrupt & ONENAND_INT_READ) {
-		ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS);
+		int ecc = this->read_word(this->base + ONENAND_REG_ECC_STATUS);
 		if (ecc) {
 			DEBUG(MTD_DEBUG_LEVEL0, "onenand_wait: ECC error = 0x%04x\n", ecc);
 			if (ecc & ONENAND_ECC_2BIT_ALL)
@@ -332,6 +332,7 @@ static int onenand_wait(struct mtd_info *mtd, int state)
 			else if (ecc & ONENAND_ECC_1BIT_ALL)
 				mtd->ecc_stats.corrected++;
 		}
+		return ecc;
 	}
 
 	return 0;
-- 
1.4.4.2


             reply	other threads:[~2006-12-29  3:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-29  3:19 Kyungmin Park [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-01-05  7:18 onenand_wait and onenane_read Kyungmin Park
     [not found] <31382027.865581167361152877.JavaMail.weblogic@ep_ml28>
2007-01-02  8:05 ` Adrian Hunter
2006-12-28  9:27 Adrian Hunter

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=31762214.867031167362377345.JavaMail.weblogic@ep_ml28 \
    --to=kyungmin.park@samsung.com \
    --cc=hunter.programmer@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