batman-adv: Drop NULL check before dropping references
The check if a batman-adv related object is NULL or not is now directly in the batadv_*_put functions. It is not needed anymore to perform this check outside these function: The changes were generated using a coccinelle semantic patch: @@ expression E; @@ - if (likely(E != NULL)) ( batadv_backbone_gw_put | batadv_claim_put | batadv_dat_entry_put | batadv_gw_node_put | batadv_hardif_neigh_put | batadv_hardif_put | batadv_nc_node_put | batadv_nc_path_put | batadv_neigh_ifinfo_put | batadv_neigh_node_put | batadv_orig_ifinfo_put | batadv_orig_node_put | batadv_orig_node_vlan_put | batadv_softif_vlan_put | batadv_tp_vars_put | batadv_tt_global_entry_put | batadv_tt_local_entry_put | batadv_tt_orig_list_entry_put | batadv_tt_req_node_put | batadv_tvlv_container_put | batadv_tvlv_handler_put )(E); Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
This commit is contained in:
committed by
Simon Wunderlich
parent
6340dcbd61
commit
79a0bffb83
@@ -445,8 +445,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
|
||||
|
||||
netif_rx_any_context(skb);
|
||||
out:
|
||||
if (primary_if)
|
||||
batadv_hardif_put(primary_if);
|
||||
batadv_hardif_put(primary_if);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1504,8 +1503,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)
|
||||
rcu_read_unlock();
|
||||
}
|
||||
out:
|
||||
if (primary_if)
|
||||
batadv_hardif_put(primary_if);
|
||||
batadv_hardif_put(primary_if);
|
||||
|
||||
queue_delayed_work(batadv_event_workqueue, &bat_priv->bla.work,
|
||||
msecs_to_jiffies(BATADV_BLA_PERIOD_LENGTH));
|
||||
@@ -1814,8 +1812,7 @@ void batadv_bla_free(struct batadv_priv *bat_priv)
|
||||
batadv_hash_destroy(bat_priv->bla.backbone_hash);
|
||||
bat_priv->bla.backbone_hash = NULL;
|
||||
}
|
||||
if (primary_if)
|
||||
batadv_hardif_put(primary_if);
|
||||
batadv_hardif_put(primary_if);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2002,10 +1999,8 @@ handled:
|
||||
ret = true;
|
||||
|
||||
out:
|
||||
if (primary_if)
|
||||
batadv_hardif_put(primary_if);
|
||||
if (claim)
|
||||
batadv_claim_put(claim);
|
||||
batadv_hardif_put(primary_if);
|
||||
batadv_claim_put(claim);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2109,10 +2104,8 @@ allow:
|
||||
handled:
|
||||
ret = true;
|
||||
out:
|
||||
if (primary_if)
|
||||
batadv_hardif_put(primary_if);
|
||||
if (claim)
|
||||
batadv_claim_put(claim);
|
||||
batadv_hardif_put(primary_if);
|
||||
batadv_claim_put(claim);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2277,8 +2270,7 @@ int batadv_bla_claim_dump(struct sk_buff *msg, struct netlink_callback *cb)
|
||||
ret = msg->len;
|
||||
|
||||
out:
|
||||
if (primary_if)
|
||||
batadv_hardif_put(primary_if);
|
||||
batadv_hardif_put(primary_if);
|
||||
|
||||
dev_put(soft_iface);
|
||||
|
||||
@@ -2448,8 +2440,7 @@ int batadv_bla_backbone_dump(struct sk_buff *msg, struct netlink_callback *cb)
|
||||
ret = msg->len;
|
||||
|
||||
out:
|
||||
if (primary_if)
|
||||
batadv_hardif_put(primary_if);
|
||||
batadv_hardif_put(primary_if);
|
||||
|
||||
dev_put(soft_iface);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user