[PATCH 2/4] mtd: Fix allowing to erase bad blocks on partitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux