Skip to content

Commit

Permalink
tty: moxa, fix refcounting in moxa_poll_port
Browse files Browse the repository at this point in the history
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 <jirislaby@gmail.com>
Reported-by: Jan 'Yenya' Kasprzak <kas@fi.muni.cz>
Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jiri Slaby authored and Linus Torvalds committed Apr 6, 2009
1 parent bbb8e6b commit 0e0fd7d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/char/moxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 0e0fd7d

Please sign in to comment.