cfi_mtd: Fix bug in last sector detection
PATCH 1/1 cfi_mtd: Fix bug in last sector detection
This patch now enabled this cfi-mtd wrapper to correctly detect and erase the last sector in an NOR FLASH device.
Signed-off-by Stefan Roese <[email protected]>
--- drivers/mtd/cfi_mtd.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
drivers/mtd/cfi_mtd.c +7 -2
@@ -43,11 +43,16 @@ static int cfi_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)int s_last =-1 ;int error, sect; -for (sect =0 ; sect < fi->sector_count -1 ; sect++) { +for (sect =0 ; sect < fi->sector_count; sect++) {if (a_start == fi->start[sect]) s_first = sect; -if (a_end == fi->start[sect +1 ]) { +if (sect < fi->sector_count -1 ) { +if (a_end == fi->start[sect +1 ]) { + s_last = sect; +break ; + } + }else { s_last = sect;break ; }
Signature · 1 line
1.6.2.5
Wolfgang Denk
AppliedPATCH 1/1 cfi_mtd: Fix bug in last sector detection
Dear Stefan Roese,
Quoted 7 lines · In message <[email protected]> you wrote:
This patch now enabled this cfi-mtd wrapper to correctly detect and erase the last sector in an NOR FLASH device.
Signed-off-by Stefan Roese <[email protected]>--- drivers/mtd/cfi_mtd.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
Applied to master, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de We, the unwilling, led by the unknowing, are doing the impossible for the ungrateful. We have done so much, for so long, with so little, we are now qualified to do anything with nothing.