diff options
-rw-r--r-- | drivers/tty/serial/serial_core.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 203cb32638c3..3253905428ea 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -2645,6 +2645,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) | |||
2645 | { | 2645 | { |
2646 | struct uart_state *state = drv->state + uport->line; | 2646 | struct uart_state *state = drv->state + uport->line; |
2647 | struct tty_port *port = &state->port; | 2647 | struct tty_port *port = &state->port; |
2648 | struct tty_struct *tty; | ||
2648 | int ret = 0; | 2649 | int ret = 0; |
2649 | 2650 | ||
2650 | BUG_ON(in_interrupt()); | 2651 | BUG_ON(in_interrupt()); |
@@ -2673,8 +2674,11 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport) | |||
2673 | */ | 2674 | */ |
2674 | tty_unregister_device(drv->tty_driver, uport->line); | 2675 | tty_unregister_device(drv->tty_driver, uport->line); |
2675 | 2676 | ||
2676 | if (port->tty) | 2677 | tty = tty_port_tty_get(port); |
2678 | if (tty) { | ||
2677 | tty_vhangup(port->tty); | 2679 | tty_vhangup(port->tty); |
2680 | tty_kref_put(tty); | ||
2681 | } | ||
2678 | 2682 | ||
2679 | /* | 2683 | /* |
2680 | * If the port is used as a console, unregister it | 2684 | * If the port is used as a console, unregister it |