From patchwork Sun Aug 21 21:38:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Juhl X-Patchwork-Id: 110842 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 15920B6F57 for ; Mon, 22 Aug 2011 07:38:33 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755770Ab1HUViO (ORCPT ); Sun, 21 Aug 2011 17:38:14 -0400 Received: from swampdragon.chaosbits.net ([90.184.90.115]:21662 "EHLO swampdragon.chaosbits.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752527Ab1HUViN (ORCPT ); Sun, 21 Aug 2011 17:38:13 -0400 Received: by swampdragon.chaosbits.net (Postfix, from userid 1000) id A0D139403D; Sun, 21 Aug 2011 23:38:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by swampdragon.chaosbits.net (Postfix) with ESMTP id 64F6C9403B; Sun, 21 Aug 2011 23:38:52 +0200 (CEST) Date: Sun, 21 Aug 2011 23:38:51 +0200 (CEST) From: Jesper Juhl To: David Miller cc: khc@pm.waw.pl, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, trivial@kernel.org Subject: Re: [PATCH][Trivial] net/wan/hdlc_ppp: remove dead goto In-Reply-To: <20110818.220249.1523360015062657902.davem@davemloft.net> Message-ID: References: <20110818.220249.1523360015062657902.davem@davemloft.net> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 18 Aug 2011, David Miller wrote: > From: Jesper Juhl > Date: Sat, 13 Aug 2011 01:39:43 +0200 (CEST) > > > From: Jesper Juhl > > > > 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 > > 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 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 --- 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;