projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fff4ef1
)
nozomi: simplify ntty_chars_in_buffer
author
Jiri Slaby
<jslaby@suse.cz>
Wed, 5 May 2021 09:19:21 +0000
(11:19 +0200)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 13 May 2021 16:29:11 +0000
(18:29 +0200)
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>
drivers/tty/nozomi.c
patch
|
blob
|
history
diff --git
a/drivers/tty/nozomi.c
b/drivers/tty/nozomi.c
index 62c16731ccd83b7475d83e1707918f3726a5295a..5e0ddf22931e31f2af3a873a486d5740f3a90beb 100644
(file)
--- 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 = {