[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210306095002.22983-2-tudor.ambarus@microchip.com>
Date: Sat, 6 Mar 2021 11:49:58 +0200
From: Tudor Ambarus <tudor.ambarus@...rochip.com>
To: <vigneshr@...com>, <p.yadav@...com>, <michael@...le.cc>
CC: <linux-mtd@...ts.infradead.org>, <miquel.raynal@...tlin.com>,
<richard@....at>, <linux-kernel@...r.kernel.org>,
Tudor Ambarus <tudor.ambarus@...rochip.com>
Subject: [PATCH v2 1/5] mtd: spi-nor: core: Advance erase after the erase cmd has been completed
addr and len were gratuitously updated even when spi_nor_wait_till_ready()
failed. Wait for the erase cmd to complete and then advance the erase.
Signed-off-by: Tudor Ambarus <tudor.ambarus@...rochip.com>
Reviewed-by: Pratyush Yadav <p.yadav@...com>
---
v2:
- update commit message
- Add R-b tag
drivers/mtd/spi-nor/core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 0522304f52fa..bcaa161bc7db 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1618,12 +1618,12 @@ static int spi_nor_erase_multi_sectors(struct spi_nor *nor, u64 addr, u32 len)
if (ret)
goto destroy_erase_cmd_list;
- addr += cmd->size;
- cmd->count--;
-
ret = spi_nor_wait_till_ready(nor);
if (ret)
goto destroy_erase_cmd_list;
+
+ addr += cmd->size;
+ cmd->count--;
}
list_del(&cmd->list);
kfree(cmd);
@@ -1704,12 +1704,12 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
if (ret)
goto erase_err;
- addr += mtd->erasesize;
- len -= mtd->erasesize;
-
ret = spi_nor_wait_till_ready(nor);
if (ret)
goto erase_err;
+
+ addr += mtd->erasesize;
+ len -= mtd->erasesize;
}
/* erase multiple sectors */
--
2.25.1
Powered by blists - more mailing lists