Skip to content

Commit 4294e4a

Browse files
Jon Linbroonie
authored andcommitted
spi: rockchip: Fix error in SPI slave pio read
The RXFLR is possible larger than rx_left in Rockchip SPI, fix it. Fixes: 01b59ce ("spi: rockchip: use irq rather than polling") Signed-off-by: Jon Lin <[email protected]> Tested-by: Emil Renner Berthing <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Reviewed-by: Emil Renner Berthing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 13a9693 commit 4294e4a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-rockchip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static void rockchip_spi_pio_writer(struct rockchip_spi *rs)
291291
static void rockchip_spi_pio_reader(struct rockchip_spi *rs)
292292
{
293293
u32 words = readl_relaxed(rs->regs + ROCKCHIP_SPI_RXFLR);
294-
u32 rx_left = rs->rx_left - words;
294+
u32 rx_left = (rs->rx_left > words) ? rs->rx_left - words : 0;
295295

296296
/* the hardware doesn't allow us to change fifo threshold
297297
* level while spi is enabled, so instead make sure to leave

0 commit comments

Comments
 (0)