diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 54122db81de4..013fb874c64e 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2702,6 +2702,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) if (uport->cons && uport->dev) of_console_check(uport->dev->of_node, uport->cons->name, uport->line); + tty_port_link_device(port, drv->tty_driver, uport->line); uart_configure_port(drv, state, uport); num_groups = 2; diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 482f33f20043..21b5ca421452 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -48,7 +48,8 @@ void tty_port_link_device(struct tty_port *port, { if (WARN_ON(index >= driver->num)) return; - driver->ports[index] = port; + if (!driver->ports[index]) + driver->ports[index] = port; } EXPORT_SYMBOL_GPL(tty_port_link_device);