Commit da4e40e2 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

max3110: Fix up port->tty backreferencing

We want to keep refcounts properly on this against hangup.
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 51808f05
...@@ -347,7 +347,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) ...@@ -347,7 +347,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
if (!port->state) if (!port->state)
return 0; return 0;
tty = port->state->port.tty; tty = tty_port_tty_get(&port->state->port);
if (!tty) if (!tty)
return 0; return 0;
...@@ -364,8 +364,10 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) ...@@ -364,8 +364,10 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
} }
} }
if (!w) if (!w) {
tty_kref_put(tty);
return 0; return 0;
}
for (r = 0; w; r += usable, w -= usable) { for (r = 0; w; r += usable, w -= usable) {
usable = tty_buffer_request_room(tty, w); usable = tty_buffer_request_room(tty, w);
...@@ -375,6 +377,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) ...@@ -375,6 +377,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
} }
} }
tty_flip_buffer_push(tty); tty_flip_buffer_push(tty);
tty_kref_put(tty);
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment