Skip to content

Commit

Permalink
batman-adv: Remove one condition check in batadv_route_unicast_packet
Browse files Browse the repository at this point in the history
It could decrease one condition check to collect some statements in the
first condition block.

Signed-off-by: Gao Feng <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
Signed-off-by: Simon Wunderlich <[email protected]>
  • Loading branch information
gfreewind authored and simonwunderlich committed Jan 26, 2017
1 parent 269cee6 commit 0843f19
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions net/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0843f19

Please sign in to comment.