[PATCH 2/2] spi: mvebu: improve error reporting

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Thu Dec 8 02:52:26 PST 2016


Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 drivers/spi/mvebu_spi.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/mvebu_spi.c b/drivers/spi/mvebu_spi.c
index c5d8732e4f84..14ab39603cbb 100644
--- a/drivers/spi/mvebu_spi.c
+++ b/drivers/spi/mvebu_spi.c
@@ -264,13 +264,19 @@ static int mvebu_spi_do_transfer(struct spi_device *spi,
 
 	if (t->bits_per_word)
 		ret = mvebu_spi_set_transfer_size(priv, spi->bits_per_word);
-	if (ret)
+	if (ret) {
+		dev_err(&spi->dev, "Failed to set transfer size (bpw = %u)\n",
+			(unsigned)spi->bits_per_word);
 		return ret;
+	}
 
 	if (t->speed_hz)
 		ret = priv->set_baudrate(priv, t->speed_hz);
-	if (ret)
+	if (ret) {
+		dev_err(&spi->dev, "Failed to set baudrate to %u Hz\n",
+			(unsigned)t->speed_hz);
 		return ret;
+	}
 
 	inc = (priv->data16) ? 2 : 1;
 	for (n = 0; n < t->len; n += inc) {
@@ -314,8 +320,10 @@ static int mvebu_spi_transfer(struct spi_device *spi, struct spi_message *msg)
 	}
 
 	ret = mvebu_spi_set_cs(priv, spi->chip_select, spi->mode, true);
-	if (ret)
+	if (ret) {
+		dev_err(&spi->dev, "Failed to set chip select\n");
 		return ret;
+	}
 
 	msg->actual_length = 0;
 
-- 
2.10.2




More information about the barebox mailing list