[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52AF0B2C.2080900@gmail.com>
Date: Mon, 16 Dec 2013 22:16:12 +0800
From: Wang Weidong <weidong1991.wang@...il.com>
To: David Laight <David.Laight@...LAB.COM>, jon.maloy@...csson.com,
allan.stephens@...driver.com, davem@...emloft.net
CC: erik.hugne@...csson.com, maloy@...jonn.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 1/4] tipc: remove unnecessary variables and conditions
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@...r.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists