mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
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@microchip.com> Reviewed-by: Pratyush Yadav <p.yadav@ti.com> Link: https://lore.kernel.org/r/20210306095002.22983-2-tudor.ambarus@microchip.com
This commit is contained in:
parent
47f25032c0
commit
786a0a75d0
1 changed files with 6 additions and 6 deletions
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue