Skip to content

Commit 135dd87

Browse files
AntonioBorneobroonie
authored andcommitted
spi: stm32h7: fix race condition at end of transfer
The caller of stm32_spi_transfer_one(), spi_transfer_one_message(), is waiting for us to call spi_finalize_current_transfer() and will eventually schedule a new transfer, if available. We should guarantee that the spi controller is really available before calling spi_finalize_current_transfer(). Move the call to spi_finalize_current_transfer() _after_ the call to stm32_spi_disable(). Signed-off-by: Antonio Borneo <[email protected]> Signed-off-by: Alain Volmat <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent ae1ba50 commit 135dd87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/spi/spi-stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,8 +971,8 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
971971
spin_unlock_irqrestore(&spi->lock, flags);
972972

973973
if (end) {
974-
spi_finalize_current_transfer(master);
975974
stm32h7_spi_disable(spi);
975+
spi_finalize_current_transfer(master);
976976
}
977977

978978
return IRQ_HANDLED;

0 commit comments

Comments
 (0)