serial: mvebu-uart: do not allow changing baudrate when uartclk is not available
authorPali Rohár <pali@kernel.org>
Thu, 24 Jun 2021 22:49:01 +0000 (00:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:56:50 +0000 (16:56 +0200)
commit9ad82f0412c04f7cf8a8522a5dca633a0c40135a
treeac8b104d281ad57b50042d3e794a7a18cc1c52a9
parentdd6d4e92e7240ed92583eacf097289a13d971d73
serial: mvebu-uart: do not allow changing baudrate when uartclk is not available

[ Upstream commit ecd6b010d81f97b06b2f64d2d4f50ebf5acddaa9 ]

Testing mvuart->clk for non-error is not enough as mvuart->clk may contain
valid clk pointer but when clk_prepare_enable(mvuart->clk) failed then
port->uartclk is zero.

When mvuart->clk is not available then port->uartclk is zero too.

Parent clock rate port->uartclk is needed to calculate UART clock divisor
and without it is not possible to change baudrate.

So fix test condition when it is possible to change baudrate.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate")
Link: https://lore.kernel.org/r/20210624224909.6350-3-pali@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/mvebu-uart.c