diff mbox

spi: core: Fix transfer failure when master->transfer_one returns positive value

Message ID 1390053922.16621.4.camel@phoenix (mailing list archive)
State Accepted
Commit 13a4279880229240af38486611c94587492b24d3
Headers show

Commit Message

Axel Lin Jan. 18, 2014, 2:05 p.m. UTC
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>
---
 drivers/spi/spi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Mark Brown Jan. 21, 2014, 6:45 p.m. UTC | #1
On Sat, Jan 18, 2014 at 10:05:22PM +0800, Axel Lin wrote:
> 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.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index db421bd..11fefd5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -609,8 +609,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);