aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty/tty_port.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/tty_port.c')
-rw-r--r--drivers/tty/tty_port.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 20426ccbd58..969c3e675a7 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -487,14 +487,16 @@ int tty_port_close_start(struct tty_port *port,
set_bit(ASYNCB_CLOSING, &port->flags);
tty->closing = 1;
spin_unlock_irqrestore(&port->lock, flags);
- /* Don't block on a stalled port, just pull the chain */
- if (tty->flow_stopped)
- tty_driver_flush_buffer(tty);
- if (test_bit(ASYNCB_INITIALIZED, &port->flags) &&
- port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
- tty_wait_until_sent_from_close(tty, port->closing_wait);
- if (port->drain_delay)
- tty_port_drain_delay(port, tty);
+
+ if (test_bit(ASYNCB_INITIALIZED, &port->flags)) {
+ /* Don't block on a stalled port, just pull the chain */
+ if (tty->flow_stopped)
+ tty_driver_flush_buffer(tty);
+ if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
+ tty_wait_until_sent_from_close(tty, port->closing_wait);
+ if (port->drain_delay)
+ tty_port_drain_delay(port, tty);
+ }
/* Flush the ldisc buffering */
tty_ldisc_flush(tty);