Patch "serial: mvebu-uart: do not allow changing baudrate when uartclk is not available" has been added to the 5.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    serial: mvebu-uart: do not allow changing baudrate when uartclk is not available

to the 5.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     serial-mvebu-uart-do-not-allow-changing-baudrate-whe.patch
and it can be found in the queue-5.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8d8e814db04a01b3fde87d0b47df24b87bf005c1
Author: Pali Rohár <pali@xxxxxxxxxx>
Date:   Fri Jun 25 00:49:01 2021 +0200

    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@xxxxxxxxxx>
    Fixes: 68a0db1d7da2 ("serial: mvebu-uart: add function to change baudrate")
    Link: https://lore.kernel.org/r/20210624224909.6350-3-pali@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
index 908a4ac6b5a7..9638ae6aae79 100644
--- a/drivers/tty/serial/mvebu-uart.c
+++ b/drivers/tty/serial/mvebu-uart.c
@@ -445,12 +445,11 @@ static void mvebu_uart_shutdown(struct uart_port *port)
 
 static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud)
 {
-	struct mvebu_uart *mvuart = to_mvuart(port);
 	unsigned int d_divisor, m_divisor;
 	u32 brdv, osamp;
 
-	if (IS_ERR(mvuart->clk))
-		return -PTR_ERR(mvuart->clk);
+	if (!port->uartclk)
+		return -EOPNOTSUPP;
 
 	/*
 	 * The baudrate is derived from the UART clock thanks to two divisors:



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux