Bug in m25p80.c during whole-chip erase
PATCH v2 1/1 Bug in m25p80.c during whole-chip erase
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.
---
drivers/mtd/devices/m25p80.c +6 -4
@@ -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
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
Quoted 30 lines
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 <[email protected]>---
drivers/mtd/devices/m25p80.c +6
-4@@ -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
Quoted 5 lines · Steven A. Falco
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
Signature · 2 lines
Best regards, Artem Bityutskiy (Битюцкий Артём)
Quoted 10 lines · Artem Bityutskiy
Quoted 5 lines · Steven A. Falco
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