mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] spi: mvebu: fix error handling for transfer problems
@ 2016-12-05 10:27 Uwe Kleine-König
  2016-12-07 19:31 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2016-12-05 10:27 UTC (permalink / raw)
  To: barebox, Sebastian Hesselbarth

When a message transfer fails no further messages are transferred, but
the error value was not propagated to the caller.

Fixes: 5db1a578d6ed ("spi: add Marvell MVEBU SoC SPI driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/spi/mvebu_spi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/mvebu_spi.c b/drivers/spi/mvebu_spi.c
index 335774d4c609..ee7b212962f7 100644
--- a/drivers/spi/mvebu_spi.c
+++ b/drivers/spi/mvebu_spi.c
@@ -305,14 +305,14 @@ static int mvebu_spi_transfer(struct spi_device *spi, struct spi_message *msg)
 	list_for_each_entry(t, &msg->transfers, transfer_list) {
 		ret = mvebu_spi_do_transfer(spi, t);
 		if (ret)
-			break;
+			goto err_transfer;
 		msg->actual_length += t->len;
 	}
 
-	ret = mvebu_spi_set_cs(priv, spi->chip_select, spi->mode, false);
-	if (ret)
-		return ret;
+	return mvebu_spi_set_cs(priv, spi->chip_select, spi->mode, false);
 
+err_transfer:
+	mvebu_spi_set_cs(priv, spi->chip_select, spi->mode, false);
 	return ret;
 }
 
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: mvebu: fix error handling for transfer problems
  2016-12-05 10:27 [PATCH] spi: mvebu: fix error handling for transfer problems Uwe Kleine-König
@ 2016-12-07 19:31 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2016-12-07 19:31 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

On Mon, Dec 05, 2016 at 11:27:43AM +0100, Uwe Kleine-König wrote:
> When a message transfer fails no further messages are transferred, but
> the error value was not propagated to the caller.
> 
> Fixes: 5db1a578d6ed ("spi: add Marvell MVEBU SoC SPI driver")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/spi/mvebu_spi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/spi/mvebu_spi.c b/drivers/spi/mvebu_spi.c
> index 335774d4c609..ee7b212962f7 100644
> --- a/drivers/spi/mvebu_spi.c
> +++ b/drivers/spi/mvebu_spi.c
> @@ -305,14 +305,14 @@ static int mvebu_spi_transfer(struct spi_device *spi, struct spi_message *msg)
>  	list_for_each_entry(t, &msg->transfers, transfer_list) {
>  		ret = mvebu_spi_do_transfer(spi, t);
>  		if (ret)
> -			break;
> +			goto err_transfer;
>  		msg->actual_length += t->len;
>  	}
>  
> -	ret = mvebu_spi_set_cs(priv, spi->chip_select, spi->mode, false);
> -	if (ret)
> -		return ret;
> +	return mvebu_spi_set_cs(priv, spi->chip_select, spi->mode, false);
>  
> +err_transfer:
> +	mvebu_spi_set_cs(priv, spi->chip_select, spi->mode, false);
>  	return ret;
>  }
>  
> -- 
> 2.10.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-07 19:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-05 10:27 [PATCH] spi: mvebu: fix error handling for transfer problems Uwe Kleine-König
2016-12-07 19:31 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox