Commit 3d183542 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

nozomi: simplify ntty_chars_in_buffer

ntty_chars_in_buffer is overly complicated. Simplify it by inverting the
condition.

Side FIXME: how can dc or port be NULL here?
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210505091928.22010-29-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fff4ef17
...@@ -1780,16 +1780,11 @@ static unsigned int ntty_chars_in_buffer(struct tty_struct *tty) ...@@ -1780,16 +1780,11 @@ static unsigned int ntty_chars_in_buffer(struct tty_struct *tty)
{ {
struct port *port = tty->driver_data; struct port *port = tty->driver_data;
struct nozomi *dc = get_dc_by_tty(tty); struct nozomi *dc = get_dc_by_tty(tty);
s32 rval = 0;
if (unlikely(!dc || !port)) { if (unlikely(!dc || !port))
goto exit_in_buffer; return 0;
}
rval = kfifo_len(&port->fifo_ul);
exit_in_buffer: return kfifo_len(&port->fifo_ul);
return rval;
} }
static const struct tty_port_operations noz_tty_port_ops = { static const struct tty_port_operations noz_tty_port_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment