Commit 786a0a75 authored by Tudor Ambarus's avatar Tudor Ambarus

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: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Reviewed-by: default avatarPratyush Yadav <p.yadav@ti.com>
Link: https://lore.kernel.org/r/20210306095002.22983-2-tudor.ambarus@microchip.com
parent 47f25032
...@@ -1618,12 +1618,12 @@ static int spi_nor_erase_multi_sectors(struct spi_nor *nor, u64 addr, u32 len) ...@@ -1618,12 +1618,12 @@ static int spi_nor_erase_multi_sectors(struct spi_nor *nor, u64 addr, u32 len)
if (ret) if (ret)
goto destroy_erase_cmd_list; goto destroy_erase_cmd_list;
addr += cmd->size;
cmd->count--;
ret = spi_nor_wait_till_ready(nor); ret = spi_nor_wait_till_ready(nor);
if (ret) if (ret)
goto destroy_erase_cmd_list; goto destroy_erase_cmd_list;
addr += cmd->size;
cmd->count--;
} }
list_del(&cmd->list); list_del(&cmd->list);
kfree(cmd); kfree(cmd);
...@@ -1704,12 +1704,12 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) ...@@ -1704,12 +1704,12 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
if (ret) if (ret)
goto erase_err; goto erase_err;
addr += mtd->erasesize;
len -= mtd->erasesize;
ret = spi_nor_wait_till_ready(nor); ret = spi_nor_wait_till_ready(nor);
if (ret) if (ret)
goto erase_err; goto erase_err;
addr += mtd->erasesize;
len -= mtd->erasesize;
} }
/* erase multiple sectors */ /* erase multiple sectors */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment