summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/inftlmount.c
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-02-12 22:03:09 +0100
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-03-15 18:21:07 +0100
commit884cfd9023ce6afe8bcf181ec988d8516eb32bf0 (patch)
treef57f5eafe52a568ac90e25b64f8e6a0e9d37e993 /drivers/mtd/inftlmount.c
parentmtd: Get rid of unused fields in struct erase_info (diff)
downloadlinux-884cfd9023ce6afe8bcf181ec988d8516eb32bf0.tar.xz
linux-884cfd9023ce6afe8bcf181ec988d8516eb32bf0.zip
mtd: Stop assuming mtd_erase() is asynchronous
None of the mtd->_erase() implementations work in an asynchronous manner, so let's simplify MTD users that call mtd_erase(). All they need to do is check the value returned by mtd_erase() and assume that != 0 means failure. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/inftlmount.c')
-rw-r--r--drivers/mtd/inftlmount.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index 8d6bb189ea8e..0f47be4834d8 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -393,9 +393,10 @@ int INFTL_formatblock(struct INFTLrecord *inftl, int block)
mark only the failed block in the bbt. */
for (physblock = 0; physblock < inftl->EraseSize;
physblock += instr->len, instr->addr += instr->len) {
- mtd_erase(inftl->mbd.mtd, instr);
+ int ret;
- if (instr->state == MTD_ERASE_FAILED) {
+ ret = mtd_erase(inftl->mbd.mtd, instr);
+ if (ret) {
printk(KERN_WARNING "INFTL: error while formatting block %d\n",
block);
goto fail;