All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-V2] Bug in m25p80.c during whole-chip erase
@ 2009-04-28 14:18 Steven A. Falco
  2009-05-27 13:53 ` Steven A. Falco
  0 siblings, 1 reply; 4+ messages in thread
From: Steven A. Falco @ 2009-04-28 14:18 UTC (permalink / raw)
  To: linux-mtd; +Cc: dwmw2

There is a logic error in "whole chip erase" for the m25p80 family.  If
the whole device is successfully erased, erase_chip() will return 0, and
the code will fall through to the "else" clause, and do sector-by-sector
erase in addition to the whole-chip erase.  This patch corrects that.

Signed-off-by: Steven A. Falco <sfalco@harris.com>
---

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 6659b22..3a2fed8 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -251,10 +251,12 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr)
 	mutex_lock(&flash->lock);
 
 	/* whole-chip erase? */
-	if (len == flash->mtd.size && erase_chip(flash)) {
-		instr->state = MTD_ERASE_FAILED;
-		mutex_unlock(&flash->lock);
-		return -EIO;
+	if (len == flash->mtd.size) {
+		if (erase_chip(flash)) {
+			instr->state = MTD_ERASE_FAILED;
+			mutex_unlock(&flash->lock);
+			return -EIO;
+		}
 
 	/* REVISIT in some cases we could speed up erasing large regions
 	 * by using OPCODE_SE instead of OPCODE_BE_4K.  We may have set up

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH-V2] Bug in m25p80.c during whole-chip erase
  2009-04-28 14:18 [PATCH-V2] Bug in m25p80.c during whole-chip erase Steven A. Falco
@ 2009-05-27 13:53 ` Steven A. Falco
  2009-05-27 14:01   ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Steven A. Falco @ 2009-05-27 13:53 UTC (permalink / raw)
  To: Steven A. Falco; +Cc: dwmw2, linux-mtd

I sent the following patch about a month ago.  There seemed to
be some interest, but I never saw anyone say they would/could
merge it.

So, is there any interest in merging this?

	Steve

> There is a logic error in "whole chip erase" for the m25p80 family.  If
> the whole device is successfully erased, erase_chip() will return 0, and
> the code will fall through to the "else" clause, and do sector-by-sector
> erase in addition to the whole-chip erase.  This patch corrects that.
> 
> Signed-off-by: Steven A. Falco <sfalco@harris.com>
> ---
> 
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 6659b22..3a2fed8 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -251,10 +251,12 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr)
>  	mutex_lock(&flash->lock);
>  
>  	/* whole-chip erase? */
> -	if (len == flash->mtd.size && erase_chip(flash)) {
> -		instr->state = MTD_ERASE_FAILED;
> -		mutex_unlock(&flash->lock);
> -		return -EIO;
> +	if (len == flash->mtd.size) {
> +		if (erase_chip(flash)) {
> +			instr->state = MTD_ERASE_FAILED;
> +			mutex_unlock(&flash->lock);
> +			return -EIO;
> +		}
>  
>  	/* REVISIT in some cases we could speed up erasing large regions
>  	 * by using OPCODE_SE instead of OPCODE_BE_4K.  We may have set up
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH-V2] Bug in m25p80.c during whole-chip erase
  2009-05-27 13:53 ` Steven A. Falco
@ 2009-05-27 14:01   ` Artem Bityutskiy
  2009-05-27 14:46     ` Steven A. Falco
  0 siblings, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2009-05-27 14:01 UTC (permalink / raw)
  To: Steven A. Falco; +Cc: linux-mtd, dwmw2

On Wed, 2009-05-27 at 09:53 -0400, Steven A. Falco wrote:
> I sent the following patch about a month ago.  There seemed to
> be some interest, but I never saw anyone say they would/could
> merge it.
> 
> So, is there any interest in merging this?

It is already in linus's tree:
http://git.infradead.org/linux-2.6.git?a=commit;h=3f33b0aaac4e208579fe5aa2964857d4e9ba10c5

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH-V2] Bug in m25p80.c during whole-chip erase
  2009-05-27 14:01   ` Artem Bityutskiy
@ 2009-05-27 14:46     ` Steven A. Falco
  0 siblings, 0 replies; 4+ messages in thread
From: Steven A. Falco @ 2009-05-27 14:46 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd, dwmw2

Artem Bityutskiy wrote:
> On Wed, 2009-05-27 at 09:53 -0400, Steven A. Falco wrote:
>> I sent the following patch about a month ago.  There seemed to
>> be some interest, but I never saw anyone say they would/could
>> merge it.
>>
>> So, is there any interest in merging this?
> 
> It is already in linus's tree:
> http://git.infradead.org/linux-2.6.git?a=commit;h=3f33b0aaac4e208579fe5aa2964857d4e9ba10c5
> 

Thanks!  I never saw the email indicating that it had been
accepted.  Sorry for the noise.

	Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-27 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-28 14:18 [PATCH-V2] Bug in m25p80.c during whole-chip erase Steven A. Falco
2009-05-27 13:53 ` Steven A. Falco
2009-05-27 14:01   ` Artem Bityutskiy
2009-05-27 14:46     ` Steven A. Falco

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.