[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d9a5f11-1dc9-03ad-cecb-af38ad421c95@hartkopp.net>
Date: Tue, 10 Mar 2020 14:07:03 +0100
From: Oliver Hartkopp <socketcan@...tkopp.net>
To: Pavel Machek <pavel@....cz>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, linux-can@...r.kernel.org,
yangerkun@...wei.com, davem@...emloft.net, mkl@...gutronix.de,
wg@...ndegger.com
Subject: Re: [PATCH] net: slcan, slip -- no need for goto when if () will do
On 09/03/2020 23.33, Pavel Machek wrote:
>
> No need to play with gotos to jump over single statement.
>
> Signed-off-by: Pavel Machek <pavel@....cz>
>
> diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
> index 2f5c287eac95..686d853fc249 100644
> --- a/drivers/net/can/slcan.c
> +++ b/drivers/net/can/slcan.c
> @@ -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();
> }
Haha. Yes, that looks indeed much better ...
Acked-by: Oliver Hartkopp <socketcan@...tkopp.net>
>
> diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
> index babb01888b78..f81fb0b13a94 100644
> --- a/drivers/net/slip/slip.c
> +++ b/drivers/net/slip/slip.c
> @@ -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();
> }
>
>
Powered by blists - more mailing lists