[PATCH, 2/2] spi: bcm-qspi: Fix return code from bcm_qspi_flash_read()

Marek Vasut marex at denx.de
Fri Jan 20 14:40:02 PST 2017


On 01/20/2017 10:50 PM, Kamal Dasu wrote:
> To properly fallback to normal mspi reads return appropriate return code to
> m25p80_read() function. Changed return code to -EINVAL from -EAGAIN to match
> what is expected by the m25p80 driver.
> 
> Signed-off-by: Kamal Dasu <kdasu.kdev at gmail.com>
> ---
>  drivers/spi/spi-bcm-qspi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
> index 14f9dea..3e37b6b 100644
> --- a/drivers/spi/spi-bcm-qspi.c
> +++ b/drivers/spi/spi-bcm-qspi.c
> @@ -919,7 +919,7 @@ static int bcm_qspi_flash_read(struct spi_device *spi,
>  
>  	if (mspi_read)
>  		/* this will make the m25p80 read to fallback to mspi read */
> -		return -EAGAIN;
> +		return -EINVAL;

This looks wrong, twice. First, why is the m25q80 driver mentioned in
this driver at all ? Second, see my comment for 1/2 , I think if the
read fails and it's because of some condition the block cannot handle,
but can recover from, the driver should deal with that.

>  	io_width = msg->data_nbits ? msg->data_nbits : SPI_NBITS_SINGLE;
>  	addrlen = msg->addr_width;
> 


-- 
Best regards,
Marek Vasut



More information about the linux-mtd mailing list