[PATCH] mtd: spi-nor: Fix return value of s25_s28_mdp_read()

Takahiro Kuwano tkuw584924 at gmail.com
Mon Jul 28 03:13:22 CEST 2025


On 7/28/2025 10:04 AM, tkuw584924 at gmail.com wrote:
> From: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
> 
> s25_s28_mdp_ready() returns 1 when spansion_sr_ready() returns negative
> value (error code). Fix this problem by following Linux implementation.
> 
> Fixes: 1c3dd193b5b ("mtd: spi-nor-core: Add fixups for Cypress s25hl-t/s25hs-t")
> Reported-by: Hiroyuki Saito <Hiroyuki.Saito2 at infineon.com>
> Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
> ---
>  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 655bf3aaf81..76c33b24368 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -3784,8 +3784,10 @@ static int s25_s28_mdp_ready(struct spi_nor *nor)
>  
>  	for (addr = 0; addr < nor->mtd.size; addr += SZ_128M) {
>  		ret = spansion_sr_ready(nor, addr, nor->rdsr_dummy);
> -		if (!ret)
> +		if (ret < 0)
>  			return ret;
> +		else if (ret == 0)
> +			return 0;
>  	}
>  
>  	return 1;
Please discard this.
I will resend with correct title.
s25_s28_mdp_read() -> s25_s28_mdp_ready()

Thanks,
Takahiro



More information about the U-Boot mailing list