Commit c799443ee13ef37221732839f1cca6f11c798b7a

Authored by Markus Elfring
Committed by Antonio Quartulli
1 parent d737ccbed3

batman-adv: Delete unnecessary checks before the function call "kfree_skb"

The kfree_skb() function tests whether its argument is NULL and then
returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

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 3 changed files with 3 additions and 6 deletions Side-by-side Diff

net/batman-adv/main.c
... ... @@ -1184,7 +1184,7 @@
1184 1184 ret = true;
1185 1185  
1186 1186 out:
1187   - if (skb && !ret)
  1187 + if (!ret)
1188 1188 kfree_skb(skb);
1189 1189 if (orig_node)
1190 1190 batadv_orig_node_free_ref(orig_node);
net/batman-adv/network-coding.c
... ... @@ -244,9 +244,7 @@
244 244 */
245 245 static void batadv_nc_packet_free(struct batadv_nc_packet *nc_packet)
246 246 {
247   - if (nc_packet->skb)
248   - kfree_skb(nc_packet->skb);
249   -
  247 + kfree_skb(nc_packet->skb);
250 248 batadv_nc_path_free_ref(nc_packet->nc_path);
251 249 kfree(nc_packet);
252 250 }
net/batman-adv/send.c
... ... @@ -407,8 +407,7 @@
407 407  
408 408 static void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet)
409 409 {
410   - if (forw_packet->skb)
411   - kfree_skb(forw_packet->skb);
  410 + kfree_skb(forw_packet->skb);
412 411 if (forw_packet->if_incoming)
413 412 batadv_hardif_free_ref(forw_packet->if_incoming);
414 413 if (forw_packet->if_outgoing)