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

Submitted by Kamal Dasu on Jan. 20, 2017, 9:50 p.m.

Details

Message ID 1484949023-2085-2-git-send-email-kdasu.kdev@gmail.com
State Rejected
Delegated to: Boris Brezillon
Headers show

Commit Message

Kamal Dasu Jan. 20, 2017, 9:50 p.m.
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@gmail.com>
---
 drivers/spi/spi-bcm-qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marek Vasut Jan. 20, 2017, 10:40 p.m.
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@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;
>

Patch hide | download patch | download mbox

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;
 
 	io_width = msg->data_nbits ? msg->data_nbits : SPI_NBITS_SINGLE;
 	addrlen = msg->addr_width;