From: Jiri Slaby Date: Mon, 6 Apr 2009 16:34:04 +0000 (+0100) Subject: tty: moxa, fix refcounting in moxa_poll_port X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0e0fd7d73ed130583dca16405b029f56bf65109f;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git tty: moxa, fix refcounting in moxa_poll_port 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 Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 8b0da97d5293..4a4cab73d0be 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; }