[PATCH 2/4] mtd: Fix allowing to erase bad blocks on partitions
Sascha Hauer
s.hauer at pengutronix.de
Thu Feb 5 02:09:56 PST 2015
Partitions are mtd devices themselves, but the 'erasebad'
parameter is only set to the master mtd device. To allow to
erase bad blocks on partitions test the master device instead
of the partition devices.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/mtd/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 82fb5f7..345752e 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -168,10 +168,10 @@ static int mtd_op_erase(struct cdev *cdev, size_t count, loff_t offset)
while (count > 0) {
dev_dbg(cdev->dev, "erase %d %d\n", addr, erase.len);
- if (!mtd->allow_erasebad)
- ret = mtd_block_isbad(mtd, addr);
- else
+ if (mtd->allow_erasebad || (mtd->master && mtd->master->allow_erasebad))
ret = 0;
+ else
+ ret = mtd_block_isbad(mtd, addr);
erase.addr = addr;
--
2.1.4
More information about the barebox
mailing list