spi: stm32h7: fix race condition at end of transfer
authorAntonio Borneo <antonio.borneo@st.com>
Mon, 10 Aug 2020 07:12:34 +0000 (09:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:31 +0000 (11:29 +0200)
commit87fb6c0331bc1823af332df2fdad3224312838b9
tree04137f467be3d5131dbdc9769bfdc2a4d5c4b611
parentc13fd34bc60730b0ac731344af0f3b8c60b13135
spi: stm32h7: fix race condition at end of transfer

[ Upstream commit 135dd873d3c76d812ae64c668adef3f2c59ed27f ]

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>
drivers/spi/spi-stm32.c