]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
batman-adv: Remove one condition check in batadv_route_unicast_packet
authorGao Feng <gfree.wind@gmail.com>
Mon, 21 Nov 2016 15:01:09 +0000 (23:01 +0800)
committerSimon Wunderlich <sw@simonwunderlich.de>
Thu, 26 Jan 2017 07:37:01 +0000 (08:37 +0100)
It could decrease one condition check to collect some statements in the
first condition block.

Signed-off-by: Gao Feng <gfree.wind@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/routing.c

index 5f050fbdfff7ddcbd368760cf0444661332ba3db..7fd740b6e36dfb0e11c67c283cec68a5cfd1b5f6 100644 (file)
@@ -719,20 +719,19 @@ 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)
-               ret = NET_RX_SUCCESS;
-
-       /* skb was consumed */
-       skb = NULL;
 
        /* translate transmit result into receive result */
        if (res == NET_XMIT_SUCCESS) {
+               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: