public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: Du Zhongdong <axdududu@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [NAND flash driver] What would mtd do if read returns -EBADMSG (ecc failed)
Date: Tue, 21 Oct 2008 09:21:59 +0300	[thread overview]
Message-ID: <1224570119.4466.99.camel@sauron> (raw)
In-Reply-To: <7ccead5b0810202311k45ff8b98hf1b3014ed27ff777@mail.gmail.com>

On Tue, 2008-10-21 at 14:11 +0800, Du Zhongdong wrote:
> Hi,
> 
> I'm doing a NAND flash driver, and I suppose if ecc cannot be
> corrected while read something from NAND flash, that block should be
> marked bad, is that right?
> 
> Reading through nand_base.c I notice that mtd->read = nand_read;
> nand_read() [MTD Interface] calls nand_do_read_ops() [Internal] to do
> the work,  and in nand_do_read_ops():
>         if (mtd->ecc_stats.failed - stats.failed)
> 		return -EBADMSG;
> -EBADMSG then is returned to the MTD layer. I tried to trace this
> information in the MTD code, but there seems to be so many and I
> cannot be sure how MTD handles this "-EBADMSG".  Any help or
> information is appreciated.

Hi, -EBADMSG means an uncorrectable ECC error. MTD layer user should
treat it like "MTD returned some data, but it is probably corrupted,
because there was an uncorrectable ECC error".

Glance drivers/mtd/ubi/io.c if you are interested about users which
handle this -EBADMSG.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

  reply	other threads:[~2008-10-21  6:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21  6:11 [NAND flash driver] What would mtd do if read returns -EBADMSG (ecc failed) Du Zhongdong
2008-10-21  6:21 ` Artem Bityutskiy [this message]
     [not found]   ` <7ccead5b0810202351n5db8e66ep1fbec555707950f6@mail.gmail.com>
2008-10-21  7:09     ` Artem Bityutskiy
2008-10-21  7:36       ` Du Zhongdong
2008-10-21  6:50 ` Ricard Wanderlof
     [not found]   ` <7ccead5b0810202358l60368b79q2aae53bd1afc218@mail.gmail.com>
     [not found]     ` <Pine.LNX.4.64.0810210915260.6120@lnxricardw.se.axis.com>
2008-10-21  7:39       ` Du Zhongdong

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=1224570119.4466.99.camel@sauron \
    --to=dedekind@infradead.org \
    --cc=axdududu@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