[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B7496@saturn3.aculab.com>
Date: Mon, 16 Dec 2013 13:33:18 -0000
From: "David Laight" <David.Laight@...LAB.COM>
To: "Wang Weidong" <wangweidong1@...wei.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
> 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
--
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