[PATCH u-boot-spi v2 2/9] mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase()
Pratyush Yadav
p.yadav at ti.com
Tue Sep 28 18:48:12 CEST 2021
On 25/09/21 07:33PM, Marek Behún wrote:
> From: Marek Behún <marek.behun at nic.cz>
>
> The spi_nor_erase() function does not check return value of the
> write_enable() call. Fix this.
This is the case for many more calls for write_enable(), but we can fix
them later I suppose.
Reviewed-by: Pratyush Yadav <p.yadav at ti.com>
>
> Signed-off-by: Marek Behún <marek.behun at nic.cz>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> Reviewed-by: Jagan Teki <jagan at amarulasolutions.com>
> Tested-by: Masami Hiramatsu <masami.hiramatsu at linaro.org>
> ---
> drivers/mtd/spi/spi-nor-core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
> index 529e7e9178..d2018ab702 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -929,7 +929,9 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
> if (ret < 0)
> goto erase_err;
> #endif
> - write_enable(nor);
> + ret = write_enable(nor);
> + if (ret < 0)
> + goto erase_err;
>
> ret = spi_nor_erase_sector(nor, addr);
> if (ret < 0)
> --
> 2.32.0
>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
More information about the U-Boot
mailing list