Skip to content

Commit

Permalink
spi: stm32h7: fix race condition at end of transfer
Browse files Browse the repository at this point in the history
[ Upstream commit 135dd87 ]

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 <antonio.borneo@st.com>
Signed-off-by: Alain Volmat <alain.volmat@st.com>
Link: https://lore.kernel.org/r/1597043558-29668-2-git-send-email-alain.volmat@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
AntonioBorneo authored and gregkh committed Sep 3, 2020
1 parent c13fd34 commit 87fb6c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi-stm32.c
Expand Up @@ -972,8 +972,8 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
spin_unlock_irqrestore(&spi->lock, flags);

if (end) {
spi_finalize_current_transfer(master);
stm32h7_spi_disable(spi);
spi_finalize_current_transfer(master);
}

return IRQ_HANDLED;
Expand Down

0 comments on commit 87fb6c0

Please sign in to comment.