Commit 8bbb7cb2324d6a5fb7ccdc4ab0099dc18b91b690
Committed by
Antonio Quartulli
1 parent
c799443ee1
batman-adv: Less checks in batadv_tvlv_unicast_send()
* Let us return directly if a call of the batadv_orig_hash_find() function returned a null pointer. * Omit the initialisation for the variable "skb" at the beginning. * Replace an assignment by a call of the kfree_skb() function and delete the affected variable "ret" then. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <a@unstable.cc>
Showing 1 changed file with 5 additions and 10 deletions Side-by-side Diff
net/batman-adv/main.c
... | ... | @@ -1143,15 +1143,14 @@ |
1143 | 1143 | struct batadv_unicast_tvlv_packet *unicast_tvlv_packet; |
1144 | 1144 | struct batadv_tvlv_hdr *tvlv_hdr; |
1145 | 1145 | struct batadv_orig_node *orig_node; |
1146 | - struct sk_buff *skb = NULL; | |
1146 | + struct sk_buff *skb; | |
1147 | 1147 | unsigned char *tvlv_buff; |
1148 | 1148 | unsigned int tvlv_len; |
1149 | 1149 | ssize_t hdr_len = sizeof(*unicast_tvlv_packet); |
1150 | - bool ret = false; | |
1151 | 1150 | |
1152 | 1151 | orig_node = batadv_orig_hash_find(bat_priv, dst); |
1153 | 1152 | if (!orig_node) |
1154 | - goto out; | |
1153 | + return; | |
1155 | 1154 | |
1156 | 1155 | tvlv_len = sizeof(*tvlv_hdr) + tvlv_value_len; |
1157 | 1156 | |
1158 | 1157 | |
... | ... | @@ -1180,14 +1179,10 @@ |
1180 | 1179 | tvlv_buff += sizeof(*tvlv_hdr); |
1181 | 1180 | memcpy(tvlv_buff, tvlv_value, tvlv_value_len); |
1182 | 1181 | |
1183 | - if (batadv_send_skb_to_orig(skb, orig_node, NULL) != NET_XMIT_DROP) | |
1184 | - ret = true; | |
1185 | - | |
1186 | -out: | |
1187 | - if (!ret) | |
1182 | + if (batadv_send_skb_to_orig(skb, orig_node, NULL) == NET_XMIT_DROP) | |
1188 | 1183 | kfree_skb(skb); |
1189 | - if (orig_node) | |
1190 | - batadv_orig_node_free_ref(orig_node); | |
1184 | +out: | |
1185 | + batadv_orig_node_free_ref(orig_node); | |
1191 | 1186 | } |
1192 | 1187 | |
1193 | 1188 | /** |