SPI lock-up with zero-length transfers

Phil Elwell phil at raspberrypi.com
Thu Jan 28 09:26:03 EST 2021


Hi,

Commit [1] - an optimisation of the PIO transfers loops of spi-bcm2835
- causes lockups if a zero-length transfer is attempted. The commit
message says that "[t]he blind and counted loops are always called
with nonzero count", which is technically true but ignores the fact
that count can be reduced to zero before entering the loop if tfr->len
is zero.

A workaround has been added in the raspberrypi/linux repo that
explicitly checks for zero-length transfers in
bcm2835_spi_transfer_one, but perhaps it would be better to catch this
degenerate case in the common framework code - I'm not an SPI expert.

Regards,

Phil

[1] 26751de25d25 ("spi: bcm2835: Micro-optimise FIFO loops")



More information about the linux-rpi-kernel mailing list