aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/nozomi.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2021-05-05 11:19:21 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-13 18:29:11 +0200
commit3d18354248b14a5ffefaa31a43fd0d45a283e97d (patch)
treee85227dbf1dbbe7de00ca3b32c8dac8b681d1688 /drivers/tty/nozomi.c
parenttty: make tty_operations::chars_in_buffer return uint (diff)
downloadlinux-dev-3d18354248b14a5ffefaa31a43fd0d45a283e97d.tar.xz
linux-dev-3d18354248b14a5ffefaa31a43fd0d45a283e97d.zip
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: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20210505091928.22010-29-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/nozomi.c')
-rw-r--r--drivers/tty/nozomi.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index 62c16731ccd8..5e0ddf22931e 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -1780,16 +1780,11 @@ static unsigned int ntty_chars_in_buffer(struct tty_struct *tty)
{
struct port *port = tty->driver_data;
struct nozomi *dc = get_dc_by_tty(tty);
- s32 rval = 0;
- if (unlikely(!dc || !port)) {
- goto exit_in_buffer;
- }
-
- rval = kfifo_len(&port->fifo_ul);
+ if (unlikely(!dc || !port))
+ return 0;
-exit_in_buffer:
- return rval;
+ return kfifo_len(&port->fifo_ul);
}
static const struct tty_port_operations noz_tty_port_ops = {