mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
d737ccbed3
commit
c799443ee1
|
@ -1184,7 +1184,7 @@ void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, u8 *src,
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (skb && !ret)
|
if (!ret)
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
if (orig_node)
|
if (orig_node)
|
||||||
batadv_orig_node_free_ref(orig_node);
|
batadv_orig_node_free_ref(orig_node);
|
||||||
|
|
|
@ -244,9 +244,7 @@ static void batadv_nc_path_free_ref(struct batadv_nc_path *nc_path)
|
||||||
*/
|
*/
|
||||||
static void batadv_nc_packet_free(struct batadv_nc_packet *nc_packet)
|
static void batadv_nc_packet_free(struct batadv_nc_packet *nc_packet)
|
||||||
{
|
{
|
||||||
if (nc_packet->skb)
|
kfree_skb(nc_packet->skb);
|
||||||
kfree_skb(nc_packet->skb);
|
|
||||||
|
|
||||||
batadv_nc_path_free_ref(nc_packet->nc_path);
|
batadv_nc_path_free_ref(nc_packet->nc_path);
|
||||||
kfree(nc_packet);
|
kfree(nc_packet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -407,8 +407,7 @@ void batadv_schedule_bat_ogm(struct batadv_hard_iface *hard_iface)
|
||||||
|
|
||||||
static void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet)
|
static void batadv_forw_packet_free(struct batadv_forw_packet *forw_packet)
|
||||||
{
|
{
|
||||||
if (forw_packet->skb)
|
kfree_skb(forw_packet->skb);
|
||||||
kfree_skb(forw_packet->skb);
|
|
||||||
if (forw_packet->if_incoming)
|
if (forw_packet->if_incoming)
|
||||||
batadv_hardif_free_ref(forw_packet->if_incoming);
|
batadv_hardif_free_ref(forw_packet->if_incoming);
|
||||||
if (forw_packet->if_outgoing)
|
if (forw_packet->if_outgoing)
|
||||||
|
|
Loading…
Reference in New Issue