diff options
author | Alan Cox <alan@linux.intel.com> | 2011-08-26 06:26:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-26 14:01:15 -0400 |
commit | da4e40e271a30ecf8b87f70619cca93c25ed0199 (patch) | |
tree | 56e8778f8f7e42121c512655b4d5b18b61e6b3f4 /drivers | |
parent | 51808f051ede81865b7af351d6c230a1ac244a22 (diff) |
max3110: Fix up port->tty backreferencing
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/serial/mrst_max3110.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c index 42aa43934b20..1aa2c3cd2146 100644 --- a/drivers/tty/serial/mrst_max3110.c +++ b/drivers/tty/serial/mrst_max3110.c | |||
@@ -347,7 +347,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) | |||
347 | if (!port->state) | 347 | if (!port->state) |
348 | return 0; | 348 | return 0; |
349 | 349 | ||
350 | tty = port->state->port.tty; | 350 | tty = tty_port_tty_get(&port->state->port); |
351 | if (!tty) | 351 | if (!tty) |
352 | return 0; | 352 | return 0; |
353 | 353 | ||
@@ -364,8 +364,10 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) | |||
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | if (!w) | 367 | if (!w) { |
368 | tty_kref_put(tty); | ||
368 | return 0; | 369 | return 0; |
370 | } | ||
369 | 371 | ||
370 | for (r = 0; w; r += usable, w -= usable) { | 372 | for (r = 0; w; r += usable, w -= usable) { |
371 | usable = tty_buffer_request_room(tty, w); | 373 | usable = tty_buffer_request_room(tty, w); |
@@ -375,6 +377,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len) | |||
375 | } | 377 | } |
376 | } | 378 | } |
377 | tty_flip_buffer_push(tty); | 379 | tty_flip_buffer_push(tty); |
380 | tty_kref_put(tty); | ||
378 | 381 | ||
379 | return r; | 382 | return r; |
380 | } | 383 | } |