From: Adrian Hunter Date: Thu, 8 Mar 2007 10:20:12 +0000 (+0200) Subject: [MTD] Correct partition failed erase address X-Git-Tag: v2.6.21-rc4~69^2~7 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74641d75275936796d239f828b80cb030e9f9b0a;p=linux-2.6 [MTD] Correct partition failed erase address 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 Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 01e4afff42..1af989023c 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -200,6 +200,11 @@ static int part_erase (struct mtd_info *mtd, struct erase_info *instr) 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; } @@ -560,4 +565,3 @@ EXPORT_SYMBOL_GPL(deregister_mtd_parser); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Nicolas Pitre "); MODULE_DESCRIPTION("Generic support for partitioning of MTD devices"); -