Skip to content

Commit c8dff3a

Browse files
fancergregkh
authored andcommitted
serial: 8250: Skip uninitialized TTY port baud rate update
It is erroneous to update the TTY port baud rate if it hasn't been initialized yet, because in that case the TTY struct isn't set. So there is no termios structure to get and re-calculate the baud if the current baud can't be reached. Let's skip the baud rate update then until the port is fully initialized. Note the update UART clock method still sets the uartclk member with a new ref clock value even if the port is turned off. The new UART ref clock rate will be used later on the port starting up procedure. Fixes: 868f3ee ("serial: 8250: Add 8250 port clock update method") Tested-by: Hans de Goede <[email protected]> Signed-off-by: Serge Semin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7718453 commit c8dff3a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/tty/serial/8250/8250_port.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,6 +2653,10 @@ void serial8250_update_uartclk(struct uart_port *port, unsigned int uartclk)
26532653
goto out_lock;
26542654

26552655
port->uartclk = uartclk;
2656+
2657+
if (!tty_port_initialized(&port->state->port))
2658+
goto out_lock;
2659+
26562660
termios = &port->state->port.tty->termios;
26572661

26582662
baud = serial8250_get_baud_rate(port, termios, NULL);

0 commit comments

Comments
 (0)