Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760561AbZCXOOI (ORCPT ); Tue, 24 Mar 2009 10:14:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758357AbZCXOGJ (ORCPT ); Tue, 24 Mar 2009 10:06:09 -0400 Received: from earthlight.etchedpixels.co.uk ([81.2.110.250]:48996 "EHLO www.etchedpixels.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755980AbZCXOGH (ORCPT ); Tue, 24 Mar 2009 10:06:07 -0400 From: Alan Cox Subject: [PATCH 25/30] tty: moxa, fix refcounting in moxa_poll_port To: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, torvalds@linux-foundation.org Date: Tue, 24 Mar 2009 14:06:01 +0000 Message-ID: <20090324140557.12735.48589.stgit@localhost.localdomain> In-Reply-To: <20090324135930.12735.7827.stgit@localhost.localdomain> References: <20090324135930.12735.7827.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1548 Lines: 58 From: Jiri Slaby There is missing tty_kref_put on some paths in moxa_poll_port, although the reference is always taken. Fix it. Signed-off-by: Jiri Slaby Reported-by: Jan 'Yenya' Kasprzak Signed-off-by: Alan Cox --- drivers/char/moxa.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 8b0da97..4a4cab7 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -1486,11 +1486,11 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle, } if (!handle) /* nothing else to do */ - return 0; + goto put; intr = readw(ip); /* port irq status */ if (intr == 0) - return 0; + goto put; writew(0, ip); /* ACK port */ ofsAddr = p->tableAddr; @@ -1499,16 +1499,17 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle, ofsAddr + HostStat); if (!inited) - return 0; + goto put; if (tty && (intr & IntrBreak) && !I_IGNBRK(tty)) { /* BREAK */ tty_insert_flip_char(tty, 0, TTY_BREAK); tty_schedule_flip(tty); } - tty_kref_put(tty); if (intr & IntrLine) moxa_new_dcdstate(p, readb(ofsAddr + FlagStat) & DCD_state); +put: + tty_kref_put(tty); return 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/