Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
3ae99599 2fc541e5

+3 -9
+3 -9
drivers/tty/n_hdlc.c
··· 584 584 unsigned long arg) 585 585 { 586 586 struct n_hdlc *n_hdlc = tty->disc_data; 587 - int error = 0; 588 587 int count; 589 588 unsigned long flags; 590 589 struct n_hdlc_buf *buf = NULL; ··· 602 603 else 603 604 count = 0; 604 605 spin_unlock_irqrestore(&n_hdlc->rx_buf_list.spinlock, flags); 605 - error = put_user(count, (int __user *)arg); 606 - break; 606 + return put_user(count, (int __user *)arg); 607 607 608 608 case TIOCOUTQ: 609 609 /* get the pending tx byte count in the driver */ ··· 614 616 if (buf) 615 617 count += buf->count; 616 618 spin_unlock_irqrestore(&n_hdlc->tx_buf_list.spinlock, flags); 617 - error = put_user(count, (int __user *)arg); 618 - break; 619 + return put_user(count, (int __user *)arg); 619 620 620 621 case TCFLSH: 621 622 switch (arg) { ··· 625 628 fallthrough; /* to default */ 626 629 627 630 default: 628 - error = n_tty_ioctl_helper(tty, cmd, arg); 629 - break; 631 + return n_tty_ioctl_helper(tty, cmd, arg); 630 632 } 631 - return error; 632 - 633 633 } /* end of n_hdlc_tty_ioctl() */ 634 634 635 635 /**