linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: slcan, slip -- no need for goto when if () will do
@ 2020-03-09 22:33 Pavel Machek
  2020-03-10 13:07 ` Oliver Hartkopp
  2020-03-12  6:15 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Machek @ 2020-03-09 22:33 UTC (permalink / raw)
  To: linux-kernel, netdev, linux-can, yangerkun, davem, mkl, wg

[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]


No need to play with gotos to jump over single statement.

Signed-off-by: Pavel Machek <pavel@ucw.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();
 }
 
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();
 }
 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: slcan, slip -- no need for goto when if () will do
  2020-03-09 22:33 [PATCH] net: slcan, slip -- no need for goto when if () will do Pavel Machek
@ 2020-03-10 13:07 ` Oliver Hartkopp
  2020-03-12  6:15 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Oliver Hartkopp @ 2020-03-10 13:07 UTC (permalink / raw)
  To: Pavel Machek, linux-kernel, netdev, linux-can, yangerkun, davem, mkl, wg



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@ucw.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@hartkopp.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();
>   }
>   
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: slcan, slip -- no need for goto when if () will do
  2020-03-09 22:33 [PATCH] net: slcan, slip -- no need for goto when if () will do Pavel Machek
  2020-03-10 13:07 ` Oliver Hartkopp
@ 2020-03-12  6:15 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-03-12  6:15 UTC (permalink / raw)
  To: pavel; +Cc: linux-kernel, netdev, linux-can, yangerkun, mkl, wg

From: Pavel Machek <pavel@ucw.cz>
Date: Mon, 9 Mar 2020 23:33:23 +0100

> No need to play with gotos to jump over single statement.
> 
> Signed-off-by: Pavel Machek <pavel@ucw.cz>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-12  6:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 22:33 [PATCH] net: slcan, slip -- no need for goto when if () will do Pavel Machek
2020-03-10 13:07 ` Oliver Hartkopp
2020-03-12  6:15 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).