spi: core: Fix transfer failure when master->transfer_one returns positive value
authorAxel Lin <axel.lin@ingics.com>
Sat, 18 Jan 2014 14:05:22 +0000 (22:05 +0800)
committerMark Brown <broonie@linaro.org>
Tue, 21 Jan 2014 18:45:34 +0000 (18:45 +0000)
master->transfer_one returns positive value is not a error.
So set ret to 0 when master->transfer_one returns positive value.
Otherwise, I hit "spi_master spi0: failed to transfer one message from queue"
error when my transfer_one callback returns 1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi.c

index 56b4109..8ed1aee 100644 (file)
@@ -599,8 +599,10 @@ static int spi_transfer_one_message(struct spi_master *master,
                        goto out;
                }
 
-               if (ret > 0)
+               if (ret > 0) {
+                       ret = 0;
                        wait_for_completion(&master->xfer_completion);
+               }
 
                trace_spi_transfer_stop(msg, xfer);