diff options
| author | Jiri Slaby (SUSE) <jirislaby@kernel.org> | 2025-11-19 11:01:33 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-11-21 18:30:40 +0100 |
| commit | 3ae99599bf47eb99f6090c9502e32993fb331e0e (patch) | |
| tree | 41e36c7f5aa3e9296000feb19e940446d37cb886 /drivers/tty | |
| parent | 2fc541e525178d6bd3c14c0d05a0e5889831da50 (diff) | |
tty: n_hdlc: simplify return from n_hdlc_tty_ioctl()
The cases in the switch() of n_hdlc_tty_ioctl() can return immediately
-- no need to store into error and return later.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://patch.msgid.link/20251119100140.830761-4-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
| -rw-r--r-- | drivers/tty/n_hdlc.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index 4a4dc58b866a..66bb8ce6ec40 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c @@ -584,7 +584,6 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct n_hdlc *n_hdlc = tty->disc_data; - int error = 0; int count; unsigned long flags; struct n_hdlc_buf *buf = NULL; @@ -603,8 +602,7 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, unsigned int cmd, else count = 0; spin_unlock_irqrestore(&n_hdlc->rx_buf_list.spinlock, flags); - error = put_user(count, (int __user *)arg); - break; + return put_user(count, (int __user *)arg); case TIOCOUTQ: /* get the pending tx byte count in the driver */ @@ -616,8 +614,7 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, unsigned int cmd, if (buf) count += buf->count; spin_unlock_irqrestore(&n_hdlc->tx_buf_list.spinlock, flags); - error = put_user(count, (int __user *)arg); - break; + return put_user(count, (int __user *)arg); case TCFLSH: switch (arg) { @@ -628,11 +625,8 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, unsigned int cmd, fallthrough; /* to default */ default: - error = n_tty_ioctl_helper(tty, cmd, arg); - break; + return n_tty_ioctl_helper(tty, cmd, arg); } - return error; - } /* end of n_hdlc_tty_ioctl() */ /** |
