X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Ftty%2Ftty_port.c;h=40b31835f80bc0d8634960a33cc5c3b1ec6d6064;hb=28023d2a8e9121b1b06c3b46e523c3c7a3e8b530;hp=1b9335796da42b2c9399dd7675200fc5f1d3cae3;hpb=a99abce2d92dd21faffc9439fa35d1519627872b;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 1b9335796da4..40b31835f80b 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -193,8 +193,7 @@ void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty) unsigned long flags; spin_lock_irqsave(&port->lock, flags); - if (port->tty) - tty_kref_put(port->tty); + tty_kref_put(port->tty); port->tty = tty_kref_get(tty); spin_unlock_irqrestore(&port->lock, flags); } @@ -473,12 +472,10 @@ int tty_port_close_start(struct tty_port *port, { unsigned long flags; - spin_lock_irqsave(&port->lock, flags); - if (tty_hung_up_p(filp)) { - spin_unlock_irqrestore(&port->lock, flags); + if (tty_hung_up_p(filp)) return 0; - } + spin_lock_irqsave(&port->lock, flags); if (tty->count == 1 && port->count != 1) { printk(KERN_WARNING "tty_port_close_start: tty->count = 1 port count = %d.\n", @@ -522,6 +519,7 @@ void tty_port_close_end(struct tty_port *port, struct tty_struct *tty) { unsigned long flags; + tty_ldisc_flush(tty); tty->closing = 0; spin_lock_irqsave(&port->lock, flags);