Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c15a3c4 authored by Antonio Borneo's avatar Antonio Borneo Committed by Greg Kroah-Hartman
Browse files

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: default avatarAntonio Borneo <antonio.borneo@st.com>
Signed-off-by: default avatarAlain Volmat <alain.volmat@st.com>
Link: https://lore.kernel.org/r/1597043558-29668-2-git-send-email-alain.volmat@st.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a08e95e8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -967,8 +967,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;