From patchwork Mon Nov 21 15:01:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6auY5bOw?= X-Patchwork-Id: 16866 X-Patchwork-Delegate: sven@narfation.org Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id D96B58325D; Mon, 21 Nov 2016 16:09:08 +0100 (CET) Authentication-Results: open-mesh.org; dmarc=none header.from=ikuai8.com Received-SPF: Pass (sender SPF authorized) identity=helo; client-ip=183.57.50.167; helo=smtpbg352.qq.com; envelope-from=fgao@ikuai8.com; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=none header.from=ikuai8.com X-Greylist: delayed 439 seconds by postgrey-1.35 at open-mesh.org; Mon, 21 Nov 2016 16:09:06 CET Received: from smtpbg352.qq.com (SMTPBG352.QQ.COM [183.57.50.167]) by open-mesh.org (Postfix) with ESMTPS id BD6F18324E for ; Mon, 21 Nov 2016 16:09:06 +0100 (CET) X-QQ-mid: bizesmtp7t1479740478ts7x7sxq6 Received: from ikuai-dev.ikuai8.com (unknown [123.56.230.35]) by esmtp4.qq.com (ESMTP) with id ; Mon, 21 Nov 2016 23:01:10 +0800 (CST) X-QQ-SSF: 01400000004000F0FH40000C0000000 X-QQ-FEAT: qEPCuVAAeQSwf0vkM6tRh0g7YBeh8G8ZtgN0P+DjvvLstw+VDuk+IVddGpL15 YNNa6qcxetopv8aTDRFWSPpoZSjQiq+nBSOonWUSO4HW/STIJciMVEUj6St0Dl9Qu06k4zb lok4KQ5tVhQh8YVpvOYpeSekw3U2XjtOp3QpmblXUO0/Ov66/RnUjD1lHT8z8qoT5ipavOy YYT93Y+3iWAXEZSsVlUOv8RpyN0FR8iCy1htJMk/s7TKRbD1zDiLSXXZEYayzVyh2VYPCWy 3dsA== X-QQ-GoodBg: 2 From: fgao@ikuai8.com To: mareklindner@neomailbox.ch, sw@simonwunderlich.de, a@unstable.cc, davem@davemloft.net, b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org, gfree.wind@gmail.com Date: Mon, 21 Nov 2016 23:01:09 +0800 Message-Id: <1479740469-3797-1-git-send-email-fgao@ikuai8.com> X-Mailer: git-send-email 1.9.1 X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Subject: [B.A.T.M.A.N.] [PATCH net-next 2/2] net: batman-adv: Remove one condition check in batadv_route_unicast_packet X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" From: Gao Feng It could decrease one condition check to collect some statements in the first condition block. Signed-off-by: Gao Feng --- net/batman-adv/routing.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 6b08b26..9d657cf 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -719,20 +719,18 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, len = skb->len; res = batadv_send_skb_to_orig(skb, orig_node, recv_if); - if (res == NET_XMIT_SUCCESS || res == NET_XMIT_CN) - ret = NET_RX_SUCCESS; - - /* skb was consumed */ - skb = NULL; - /* translate transmit result into receive result */ if (res == NET_XMIT_SUCCESS || res == NET_XMIT_CN) { + ret = NET_RX_SUCCESS; /* skb was transmitted and consumed */ batadv_inc_counter(bat_priv, BATADV_CNT_FORWARD); batadv_add_counter(bat_priv, BATADV_CNT_FORWARD_BYTES, len + ETH_HLEN); } + /* skb was consumed */ + skb = NULL; + put_orig_node: batadv_orig_node_put(orig_node); free_skb: