serial: stm32: move dma_request_chan() before clk_prepare_enable()
authorValentin Caron <valentin.caron@foss.st.com>
Fri, 18 Nov 2022 17:06:02 +0000 (18:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:39 +0000 (13:32 +0100)
commit408f64a6de74003f2164d839566eb8c4bb2676c4
treeb941f083ab28dc280bd4f90b3ce5f501523f2269
parent898a162d5fc4565ce9e4dd2be6a3d97e2878a277
serial: stm32: move dma_request_chan() before clk_prepare_enable()

[ Upstream commit 0d114e9ff940ebad8e88267013bf96c605a6b336 ]

If dma_request_chan() returns a PROBE_DEFER error, clk_disable_unprepare()
will be called and USART clock will be disabled. But early console can be
still active on the same USART.

While moving dma_request_chan() before clk_prepare_enable(), the clock
won't be taken in case of a DMA PROBE_DEFER error, and so it doesn't need
to be disabled. Then USART is still clocked for early console.

Fixes: a7770a4bfcf4 ("serial: stm32: defer probe for dma devices")
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Link: https://lore.kernel.org/r/20221118170602.1057863-1-valentin.caron@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/stm32-usart.c