public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Adrian Hunter <ext-adrian.hunter@nokia.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] [MTD] Correct partition failed erase address
Date: Thu, 08 Mar 2007 10:27:50 +0000	[thread overview]
Message-ID: <1173349670.3461.398.camel@pmac.infradead.org> (raw)
In-Reply-To: <45EFE35C.70604@nokia.com>

On Thu, 2007-03-08 at 12:20 +0200, Adrian Hunter wrote:
> If an erase operation fails, the address at which the
> failure occurred is returned by the driver.  The MTD
> partition must adjust this address (by subtracting the
> partition offset) before returning to the caller.
> This was not happening, which caused JFFS2 to mark
> the wrong block bad!
> 
> Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
> ---
>  drivers/mtd/mtdpart.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 633def3..476fbb6 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -200,6 +200,11 @@ static int part_erase (struct mtd_info *
>  		return -EINVAL;
>  	instr->addr += part->offset;
>  	ret = part->master->erase(part->master, instr);
> +	if (ret) {
> +		if (instr->fail_addr != 0xffffffff)
> +			instr->fail_addr -= part->offset;
> +		instr->addr -= part->offset;
> +	}
>  	return ret;
>  }
 
Erase isn't always synchronous. It can return success (i.e. erase queued
successfully) and later call the callback with an indication of failure.

-- 
dwmw2

  reply	other threads:[~2007-03-08 10:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-08 10:20 [PATCH] [MTD] Correct partition failed erase address Adrian Hunter
2007-03-08 10:27 ` David Woodhouse [this message]
2007-03-08 10:33   ` David Woodhouse
     [not found]     ` <45EFE727.5070509@nokia.com>
2007-03-08 10:43       ` David Woodhouse
2007-03-08 12:56         ` Jörn Engel

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=1173349670.3461.398.camel@pmac.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=ext-adrian.hunter@nokia.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