We want to keep refcounts properly on this against hangup.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
if (!port->state)
return 0;
if (!port->state)
return 0;
- tty = port->state->port.tty;
+ tty = tty_port_tty_get(&port->state->port);
+ if (!w) {
+ tty_kref_put(tty);
for (r = 0; w; r += usable, w -= usable) {
usable = tty_buffer_request_room(tty, w);
for (r = 0; w; r += usable, w -= usable) {
usable = tty_buffer_request_room(tty, w);
}
}
tty_flip_buffer_push(tty);
}
}
tty_flip_buffer_push(tty);