Message ID | 52B168E0.1060108@huawei.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On 2013/12/18 17:20, Wang Weidong wrote: > In switch() had do return, and never use the 'return NULL'. The > 'break' after return or goto has no effect. Remove it. > > Signed-off-by: Wang Weidong <wangweidong1@huawei.com> > --- > net/sctp/input.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/net/sctp/input.c b/net/sctp/input.c > index 2a192a7..c956dc9 100644 > --- a/net/sctp/input.c > +++ b/net/sctp/input.c > @@ -1120,15 +1120,10 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, > case SCTP_CID_INIT: > case SCTP_CID_INIT_ACK: > return __sctp_rcv_init_lookup(net, skb, laddr, transportp); > - break; > > default: > return __sctp_rcv_walk_lookup(net, skb, laddr, transportp); > - break; > } > - > - > - return NULL; > } > > /* Lookup an association for an inbound skb. */ > Sorry for sending the Subject "[PATCH net-next 2/3] ...". It is only one patch, not series. Regards. Wang -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Dec 18, 2013 at 05:20:32PM +0800, Wang Weidong wrote: > In switch() had do return, and never use the 'return NULL'. The > 'break' after return or goto has no effect. Remove it. > > Signed-off-by: Wang Weidong <wangweidong1@huawei.com> > --- > net/sctp/input.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/net/sctp/input.c b/net/sctp/input.c > index 2a192a7..c956dc9 100644 > --- a/net/sctp/input.c > +++ b/net/sctp/input.c > @@ -1120,15 +1120,10 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, > case SCTP_CID_INIT: > case SCTP_CID_INIT_ACK: > return __sctp_rcv_init_lookup(net, skb, laddr, transportp); > - break; > > default: > return __sctp_rcv_walk_lookup(net, skb, laddr, transportp); > - break; > } > - > - > - return NULL; > } > > /* Lookup an association for an inbound skb. */ > -- > 1.7.12 > > > If you're going to do this, it seems like you may just as well convert the switch to be if (ch->type && ch->type <= SCTP_CID_INIT_ACK) {...} else {...} That seems like it would be more readable to me. Neil -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Wang Weidong <wangweidong1@huawei.com> On 2013/12/18 22:06, Neil Horman wrote: > On Wed, Dec 18, 2013 at 05:20:32PM +0800, Wang Weidong wrote: >> In switch() had do return, and never use the 'return NULL'. The >> 'break' after return or goto has no effect. Remove it. >> >> Signed-off-by: Wang Weidong <wangweidong1@huawei.com> >> --- >> net/sctp/input.c | 5 ----- >> 1 file changed, 5 deletions(-) >> >> diff --git a/net/sctp/input.c b/net/sctp/input.c >> index 2a192a7..c956dc9 100644 >> --- a/net/sctp/input.c >> +++ b/net/sctp/input.c >> @@ -1120,15 +1120,10 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, >> case SCTP_CID_INIT: >> case SCTP_CID_INIT_ACK: >> return __sctp_rcv_init_lookup(net, skb, laddr, transportp); >> - break; >> >> default: >> return __sctp_rcv_walk_lookup(net, skb, laddr, transportp); >> - break; >> } >> - >> - >> - return NULL; >> } >> >> /* Lookup an association for an inbound skb. */ >> -- >> 1.7.12 >> >> >> > > If you're going to do this, it seems like you may just as well convert the > switch to be if (ch->type && ch->type <= SCTP_CID_INIT_ACK) {...} else {...} > > > That seems like it would be more readable to me. > > Neil > Hm, I will fix it. Thanks. > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/sctp/input.c b/net/sctp/input.c index 2a192a7..c956dc9 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c @@ -1120,15 +1120,10 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, case SCTP_CID_INIT: case SCTP_CID_INIT_ACK: return __sctp_rcv_init_lookup(net, skb, laddr, transportp); - break; default: return __sctp_rcv_walk_lookup(net, skb, laddr, transportp); - break; } - - - return NULL; } /* Lookup an association for an inbound skb. */
In switch() had do return, and never use the 'return NULL'. The 'break' after return or goto has no effect. Remove it. Signed-off-by: Wang Weidong <wangweidong1@huawei.com> --- net/sctp/input.c | 5 ----- 1 file changed, 5 deletions(-)