From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: greg@kroah.com, linux-serial@vger.kernel.org
Subject: [PATCH 4/4] max3110: Fix up port->tty backreferencing
Date: Fri, 26 Aug 2011 11:26:00 +0100 [thread overview]
Message-ID: <20110826102546.17010.25347.stgit@localhost.localdomain> (raw)
In-Reply-To: <20110826102414.17010.71484.stgit@localhost.localdomain>
From: Alan Cox <alan@linux.intel.com>
We want to keep refcounts properly on this against hangup.
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
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 4f90411..f3ddbcd 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)
if (!port->state)
return 0;
- tty = port->state->port.tty;
+ tty = tty_port_tty_get(&port->state->port);
if (!tty)
return 0;
@@ -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;
+ }
for (r = 0; w; r += usable, w -= usable) {
usable = tty_buffer_request_room(tty, w);
@@ -375,6 +377,7 @@ receive_chars(struct uart_max3110 *max, unsigned short *str, int len)
}
}
tty_flip_buffer_push(tty);
+ tty_kref_put(tty);
return r;
}
prev parent reply other threads:[~2011-08-26 11:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-26 10:24 [PATCH 1/4] max3110: wake up fixes Alan Cox
2011-08-26 10:25 ` [PATCH 2/4] x86/mrst: Add platform data for Max3110 devices Alan Cox
2011-08-26 10:25 ` [PATCH 3/4] max3110: add sysrq support Alan Cox
2011-08-26 10:26 ` Alan Cox [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110826102546.17010.25347.stgit@localhost.localdomain \
--to=alan@lxorguk.ukuu.org.uk \
--cc=greg@kroah.com \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).