mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: [PATCH] spi: mvebu: fix error handling for transfer problems
Date: Mon,  5 Dec 2016 11:27:43 +0100	[thread overview]
Message-ID: <20161205102743.3896-1-u.kleine-koenig@pengutronix.de> (raw)

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

             reply	other threads:[~2016-12-05 10:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 10:27 Uwe Kleine-König [this message]
2016-12-07 19:31 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161205102743.3896-1-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sebastian.hesselbarth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox