[PATCH 9/9] tty: serial_core: add tty NULL check in uart_port_startup
From: Rob Herring
Date: Fri Sep 09 2016 - 18:37:36 EST
If we don't have a tty when calling uart_port_startup, skip the baudrate
and modem control setup which depend on tty->termios struct. Either
tty_port clients will configure the line in a separate call or we'll
move termios into the tty_port.
Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
---
drivers/tty/serial/serial_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index b9ec9fd688a2..2c3b187d517b 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -199,7 +199,7 @@ static int uart_port_startup(struct tty_port *port, int init_hw)
}
retval = uport->ops->startup(uport);
- if (retval == 0) {
+ if (retval == 0 && tty) {
if (uart_console(uport) && uport->cons->cflag) {
tty->termios.c_cflag = uport->cons->cflag;
uport->cons->cflag = 0;
--
2.9.3