All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Weidong <weidong1991.wang@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>,
	Wang Weidong <wangweidong1@huawei.com>
Cc: David Miller <davem@davemloft.net>,
	Vlad Yasevich <vyasevich@gmail.com>,
	netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next 2/3] sctp: remove the never used 'return' and, redundant 'break'
Date: Wed, 18 Dec 2013 14:33:09 +0000	[thread overview]
Message-ID: <52B1B225.2040600@gmail.com> (raw)
In-Reply-To: <20131218140654.GB10471@neilslaptop.think-freely.org>

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
>

WARNING: multiple messages have this Message-ID (diff)
From: Wang Weidong <weidong1991.wang@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>,
	Wang Weidong <wangweidong1@huawei.com>
Cc: David Miller <davem@davemloft.net>,
	Vlad Yasevich <vyasevich@gmail.com>,
	netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next 2/3] sctp: remove the never used 'return' and, redundant 'break'
Date: Wed, 18 Dec 2013 22:33:09 +0800	[thread overview]
Message-ID: <52B1B225.2040600@gmail.com> (raw)
In-Reply-To: <20131218140654.GB10471@neilslaptop.think-freely.org>

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
>

  reply	other threads:[~2013-12-18 14:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18  9:20 [PATCH net-next 2/3] sctp: remove the never used 'return' and, redundant 'break' Wang Weidong
2013-12-18  9:20 ` Wang Weidong
2013-12-18  9:38 ` Wang Weidong
2013-12-18  9:38   ` Wang Weidong
2013-12-18 14:06 ` Neil Horman
2013-12-18 14:06   ` Neil Horman
2013-12-18 14:33   ` Wang Weidong [this message]
2013-12-18 14:33     ` Wang Weidong
2013-12-19  2:02 ` [PATCH net-next v2] sctp: remove the never used 'return' and " Wang Weidong
2013-12-19  2:02   ` Wang Weidong
2013-12-19 12:12   ` Neil Horman
2013-12-19 12:12     ` Neil Horman
2013-12-22 23:57   ` David Miller
2013-12-22 23:57     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52B1B225.2040600@gmail.com \
    --to=weidong1991.wang@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=vyasevich@gmail.com \
    --cc=wangweidong1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.