From: Wang Weidong <weidong1991.wang@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>,
jon.maloy@ericsson.com, allan.stephens@windriver.com,
davem@davemloft.net
Cc: erik.hugne@ericsson.com, maloy@donjonn.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/4] tipc: remove unnecessary variables and conditions
Date: Mon, 16 Dec 2013 22:16:12 +0800 [thread overview]
Message-ID: <52AF0B2C.2080900@gmail.com> (raw)
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B7496@saturn3.aculab.com>
On 2013/12/16 21:33, David Laight wrote:
>> From: Wang Weidong
>> Sent: 16 December 2013 12:40
>> We remove a number of unnecessary variables and branches
>> in TIPC. This patch is cosmetic and does not change the
>> operation of TIPC in any way.
>>
> ...
>> int __tipc_disconnect(struct tipc_port *tp_ptr)
>> {
>> - int res;
>> -
>> if (tp_ptr->connected) {
>> tp_ptr->connected = 0;
>> /* let timer expire on it's own to avoid deadlock! */
>> tipc_nodesub_unsubscribe(&tp_ptr->subscription);
>> - res = 0;
>> - } else {
>> - res = -ENOTCONN;
>> + return 0;
>> }
>> - return res;
>> +
>> + return -ENOTCONN;
>> }
>
> IMHO better coded as:
>
> if (!tp_ptr->connected)
> return -ENOTCON;
>
> tp_ptr->connected = 0;
> /* let timer expire on it's own to avoid deadlock! */
> tipc_nodesub_unsubscribe(&tp_ptr->subscription);
> return 0;
>
> David
>
>
Sure, I will fix it in v2.
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
>
next prev parent reply other threads:[~2013-12-16 14:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-16 12:40 [PATCH RESEND net-next 0/4] tipc: do some clean up Wang Weidong
2013-12-16 12:40 ` [PATCH net-next 1/4] tipc: remove unnecessary variables and conditions Wang Weidong
2013-12-16 13:33 ` David Laight
2013-12-16 14:16 ` Wang Weidong [this message]
2013-12-16 12:40 ` [PATCH net-next 2/4] tipc: kill unnecessary goto's Wang Weidong
2013-12-16 13:30 ` David Laight
2013-12-16 14:19 ` Wang Weidong
2013-12-16 18:01 ` David Miller
2013-12-17 6:00 ` Wang Weidong
2013-12-16 12:40 ` [PATCH net-next 3/4] tipc: Use <linux/uaccess.h> instead of <asm/uaccess.h> Wang Weidong
2013-12-16 12:40 ` [PATCH net-next 4/4] tipc: change lock_sock order in connect() Wang Weidong
2013-12-16 17:58 ` [PATCH RESEND net-next 0/4] tipc: do some clean up David Miller
2013-12-17 1:18 ` Wang Weidong
-- strict thread matches above, loose matches on Subject: below --
2013-12-12 1:36 [PATCH " Wang Weidong
2013-12-12 1:36 ` [PATCH net-next 1/4] tipc: remove unnecessary variables and conditions Wang Weidong
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=52AF0B2C.2080900@gmail.com \
--to=weidong1991.wang@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=allan.stephens@windriver.com \
--cc=davem@davemloft.net \
--cc=erik.hugne@ericsson.com \
--cc=jon.maloy@ericsson.com \
--cc=maloy@donjonn.com \
--cc=netdev@vger.kernel.org \
/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 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).