[PATCH] spi: mvebu: fix error handling for transfer problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux