Skip to content

Commit 68a1670

Browse files
bjdooks-ctbroonie
authored andcommitted
spi: s3c64xx: fix timeout counters in flush_fifo
In the s3c64xx_flush_fifo() code, the loops counter is post-decremented in the do { } while(test && loops--) condition. This means the loops is left at the unsigned equivalent of -1 if the loop times out. The test after will never pass as if tests for loops == 0. Signed-off-by: Ben Dooks <[email protected]> Fixes: 230d42d ("spi: Add s3c64xx SPI Controller driver") Reviewed-by: Andi Shyti <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 162d9b5 commit 68a1670

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/spi/spi-s3c64xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd)
245245
loops = msecs_to_loops(1);
246246
do {
247247
val = readl(regs + S3C64XX_SPI_STATUS);
248-
} while (TX_FIFO_LVL(val, sdd) && loops--);
248+
} while (TX_FIFO_LVL(val, sdd) && --loops);
249249

250250
if (loops == 0)
251251
dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n");
@@ -258,7 +258,7 @@ static void s3c64xx_flush_fifo(struct s3c64xx_spi_driver_data *sdd)
258258
readl(regs + S3C64XX_SPI_RX_DATA);
259259
else
260260
break;
261-
} while (loops--);
261+
} while (--loops);
262262

263263
if (loops == 0)
264264
dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO\n");

0 commit comments

Comments
 (0)