Skip to content

Commit e6a0b67

Browse files
tititiou36broonie
authored andcommitted
spi: synquacer: Fix timeout handling in synquacer_spi_transfer_one()
wait_for_completion_timeout() never returns a <0 value. It returns either on timeout or a positive value (at least 1, or number of jiffies left till timeout) So, fix the error handling path and return -ETIMEDOUT should a timeout occur. Fixes: b0823ee ("spi: Add spi driver for Socionext SynQuacer platform") Signed-off-by: Christophe JAILLET <[email protected]> Acked-by: Jassi Brar <[email protected]> Link: https://lore.kernel.org/r/c2040bf3cfa201fd8890cfab14fa5a701ffeca14.1676466072.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <[email protected]>
1 parent 1dd4659 commit e6a0b67

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/spi/spi-synquacer.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,9 @@ static int synquacer_spi_transfer_one(struct spi_master *master,
472472
read_fifo(sspi);
473473
}
474474

475-
if (status < 0) {
476-
dev_err(sspi->dev, "failed to transfer. status: 0x%x\n",
477-
status);
478-
return status;
475+
if (status == 0) {
476+
dev_err(sspi->dev, "failed to transfer. Timeout.\n");
477+
return -ETIMEDOUT;
479478
}
480479

481480
return 0;

0 commit comments

Comments
 (0)