mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/6] mtd: Fix allowing to erase bad blocks on partitions
Date: Tue, 10 Feb 2015 10:03:30 +0100	[thread overview]
Message-ID: <1423559014-3783-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1423559014-3783-1-git-send-email-s.hauer@pengutronix.de>

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


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

  parent reply	other threads:[~2015-02-10  9:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10  9:03 [PATCH v2] nand-bb fixes Sascha Hauer
2015-02-10  9:03 ` [PATCH 1/6] mtd: nand: omap: Fix OMAP_ECC_BCH8_CODE_HW ecc mode Sascha Hauer
2015-02-10  9:03 ` Sascha Hauer [this message]
2015-02-10  9:03 ` [PATCH 3/6] mtd: nand-bb: Fix accesses beyond device Sascha Hauer
2015-02-10  9:03 ` [PATCH 4/6] mtd: nand-bb: fix erasing bb devices with bad blocks Sascha Hauer
2015-02-10  9:03 ` [PATCH 5/6] mtd: nand-bb: Fix test for bad block when reading Sascha Hauer
2015-02-10  9:03 ` [PATCH 6/6] mtd: nand-bb: Also print raw position in debug messages Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423559014-3783-3-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox