netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][Trivial] net/wan/hdlc_ppp: remove dead goto
@ 2011-08-12 23:39 Jesper Juhl
  2011-08-19  5:02 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Juhl @ 2011-08-12 23:39 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: netdev, linux-kernel, trivial

From: Jesper Juhl <jj@chaosbits.net>

We'll either hit one of the case labels or the default in the switch
and in all cases do we then 'goto out', so having 'goto out' right
after the switch is pointless as we can never hit it - remove it.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wan/hdlc_ppp.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index 055a918..5385876 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -547,7 +547,6 @@ static int ppp_rx(struct sk_buff *skb)
 		ppp_cp_event(dev, pid, RUC, 0, 0, len, cp);
 		goto out;
 	}
-	goto out;
 
 rx_error:
 	dev->stats.rx_errors++;
-- 
1.7.6


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

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

* Re: [PATCH][Trivial] net/wan/hdlc_ppp: remove dead goto
  2011-08-12 23:39 [PATCH][Trivial] net/wan/hdlc_ppp: remove dead goto Jesper Juhl
@ 2011-08-19  5:02 ` David Miller
  2011-08-21 21:38   ` Jesper Juhl
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2011-08-19  5:02 UTC (permalink / raw)
  To: jj; +Cc: khc, netdev, linux-kernel, trivial

From: Jesper Juhl <jj@chaosbits.net>
Date: Sat, 13 Aug 2011 01:39:43 +0200 (CEST)

> From: Jesper Juhl <jj@chaosbits.net>
> 
> We'll either hit one of the case labels or the default in the switch
> and in all cases do we then 'goto out', so having 'goto out' right
> after the switch is pointless as we can never hit it - remove it.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Probably a lot cleaner to use break statements in the switch() statement
and keep this goto in place.

That's more straightforward control flow than what this thing is doing.

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

* Re: [PATCH][Trivial] net/wan/hdlc_ppp: remove dead goto
  2011-08-19  5:02 ` David Miller
@ 2011-08-21 21:38   ` Jesper Juhl
  2011-08-22 20:52     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Jesper Juhl @ 2011-08-21 21:38 UTC (permalink / raw)
  To: David Miller; +Cc: khc, netdev, linux-kernel, trivial

On Thu, 18 Aug 2011, David Miller wrote:

> From: Jesper Juhl <jj@chaosbits.net>
> Date: Sat, 13 Aug 2011 01:39:43 +0200 (CEST)
> 
> > From: Jesper Juhl <jj@chaosbits.net>
> > 
> > We'll either hit one of the case labels or the default in the switch
> > and in all cases do we then 'goto out', so having 'goto out' right
> > after the switch is pointless as we can never hit it - remove it.
> > 
> > Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> 
> Probably a lot cleaner to use break statements in the switch() statement
> and keep this goto in place.
> 
> That's more straightforward control flow than what this thing is doing.

Here you are :)


From: Jesper Juhl <jj@chaosbits.net>
Subject: [PATCH] net/wan/hdlc_ppp: use break in switch

We'll either hit one of the case labels or the default in the switch
and in all cases do we then 'goto out' and we also have a 'goto out'
after the switch that is redundant. Change to just use break in the
case statements and leave the 'goto out' after the lop for everyone to
hit.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/wan/hdlc_ppp.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wan/hdlc_ppp.c b/drivers/net/wan/hdlc_ppp.c
index 055a918..0d76455 100644
--- a/drivers/net/wan/hdlc_ppp.c
+++ b/drivers/net/wan/hdlc_ppp.c
@@ -515,37 +515,37 @@ static int ppp_rx(struct sk_buff *skb)
 	switch (cp->code) {
 	case CP_CONF_REQ:
 		ppp_cp_parse_cr(dev, pid, cp->id, len, skb->data);
-		goto out;
+		break;
 
 	case CP_CONF_ACK:
 		if (cp->id == proto->cr_id)
 			ppp_cp_event(dev, pid, RCA, 0, 0, 0, NULL);
-		goto out;
+		break;
 
 	case CP_CONF_REJ:
 	case CP_CONF_NAK:
 		if (cp->id == proto->cr_id)
 			ppp_cp_event(dev, pid, RCN, 0, 0, 0, NULL);
-		goto out;
+		break;
 
 	case CP_TERM_REQ:
 		ppp_cp_event(dev, pid, RTR, 0, cp->id, 0, NULL);
-		goto out;
+		break;
 
 	case CP_TERM_ACK:
 		ppp_cp_event(dev, pid, RTA, 0, 0, 0, NULL);
-		goto out;
+		break;
 
 	case CP_CODE_REJ:
 		ppp_cp_event(dev, pid, RXJ_BAD, 0, 0, 0, NULL);
-		goto out;
+		break;
 
 	default:
 		len += sizeof(struct cp_header);
 		if (len > dev->mtu)
 			len = dev->mtu;
 		ppp_cp_event(dev, pid, RUC, 0, 0, len, cp);
-		goto out;
+		break;
 	}
 	goto out;
 
-- 
1.7.6



-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

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

* Re: [PATCH][Trivial] net/wan/hdlc_ppp: remove dead goto
  2011-08-21 21:38   ` Jesper Juhl
@ 2011-08-22 20:52     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-08-22 20:52 UTC (permalink / raw)
  To: jj; +Cc: khc, netdev, linux-kernel, trivial

From: Jesper Juhl <jj@chaosbits.net>
Date: Sun, 21 Aug 2011 23:38:51 +0200 (CEST)

> From: Jesper Juhl <jj@chaosbits.net>
> Subject: [PATCH] net/wan/hdlc_ppp: use break in switch
> 
> We'll either hit one of the case labels or the default in the switch
> and in all cases do we then 'goto out' and we also have a 'goto out'
> after the switch that is redundant. Change to just use break in the
> case statements and leave the 'goto out' after the lop for everyone to
> hit.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Applied.

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

end of thread, other threads:[~2011-08-22 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-12 23:39 [PATCH][Trivial] net/wan/hdlc_ppp: remove dead goto Jesper Juhl
2011-08-19  5:02 ` David Miller
2011-08-21 21:38   ` Jesper Juhl
2011-08-22 20:52     ` 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).