net: slcan, slip -- no need for goto when if () will do
Subsystems (3)
PATCH 1/1 net: slcan, slip -- no need for goto when if () will do
No need to play with gotos to jump over single statement.
Signed-off-by Pavel Machek <[email protected]>
drivers/net/can/slcan.c +2 -5
@@ -348,11 +348,8 @@ static void slcan_write_wakeup(struct tty_struct *tty)rcu_read_lock (); sl =rcu_dereference (tty->disc_data); -if (!sl) - goto out; - -schedule_work (&sl->tx_work); -out: +if (sl) +schedule_work (&sl->tx_work);rcu_read_unlock (); }
drivers/net/slip/slip.c +2 -5
@@ -456,11 +456,8 @@ static void slip_write_wakeup(struct tty_struct *tty)rcu_read_lock (); sl =rcu_dereference (tty->disc_data); -if (!sl) - goto out; - -schedule_work (&sl->tx_work); -out: +if (sl) +schedule_work (&sl->tx_work);rcu_read_unlock (); }
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 12 lines · Pavel Machek
No need to play with gotos to jump over single statement.
Signed-off-by Pavel Machek <[email protected]>drivers/net/can/slcan.c +0
-0@@ -348,11 +348,8 @@ static void slcan_write_wakeup(struct tty_struct *tty)rcu_read_lock ();
drivers/net/can/slcan.c static void slcan_write_wakeup(struct tty_struct *tty) · line 354
Quoted 10 lines
drivers/net/can/slcan.c +2
-5sl =rcu_dereference (tty->disc_data); -if (!sl) - goto out; - -schedule_work (&sl->tx_work); -out: +if (sl) +schedule_work (&sl->tx_work);rcu_read_unlock (); }
Haha. Yes, that looks indeed much better ...
Acked-by Oliver Hartkopp <[email protected]>
Quoted 20 lines
drivers/net/slip/slip.c +2
-5@@ -456,11 +456,8 @@ static void slip_write_wakeup(struct tty_struct *tty)rcu_read_lock (); sl =rcu_dereference (tty->disc_data); -if (!sl) - goto out; - -schedule_work (&sl->tx_work); -out: +if (sl) +schedule_work (&sl->tx_work);rcu_read_unlock (); }
From: Pavel Machek <[email protected]>
Date: Mon, 9 Mar 2020 23:33:23 +0100
Quoted 3 lines
No need to play with gotos to jump over single statement.
Signed-off-by Pavel Machek <[email protected]>
Applied, thanks.