netfilter: Deletion of unnecessary checks before two function calls
The functions free_percpu() and module_put() test whether their argument is NULL and then return immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Julian Anastasov <ja@ssi.bg> Acked-by: Simon Horman <horms@verge.net.au> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
committed by
Pablo Neira Ayuso
parent
2c7b5d5dac
commit
982f405136
@@ -465,8 +465,7 @@ __ip_vs_bind_svc(struct ip_vs_dest *dest, struct ip_vs_service *svc)
|
|||||||
|
|
||||||
static void ip_vs_service_free(struct ip_vs_service *svc)
|
static void ip_vs_service_free(struct ip_vs_service *svc)
|
||||||
{
|
{
|
||||||
if (svc->stats.cpustats)
|
free_percpu(svc->stats.cpustats);
|
||||||
free_percpu(svc->stats.cpustats);
|
|
||||||
kfree(svc);
|
kfree(svc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name)
|
|||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
return pe;
|
return pe;
|
||||||
}
|
}
|
||||||
if (pe->module)
|
module_put(pe->module);
|
||||||
module_put(pe->module);
|
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
|||||||
@@ -104,8 +104,7 @@ static struct ip_vs_scheduler *ip_vs_sched_getbyname(const char *sched_name)
|
|||||||
mutex_unlock(&ip_vs_sched_mutex);
|
mutex_unlock(&ip_vs_sched_mutex);
|
||||||
return sched;
|
return sched;
|
||||||
}
|
}
|
||||||
if (sched->module)
|
module_put(sched->module);
|
||||||
module_put(sched->module);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&ip_vs_sched_mutex);
|
mutex_unlock(&ip_vs_sched_mutex);
|
||||||
|
|||||||
@@ -820,8 +820,7 @@ ip_vs_conn_fill_param_sync(struct net *net, int af, union ip_vs_sync_conn *sc,
|
|||||||
|
|
||||||
p->pe_data = kmemdup(pe_data, pe_data_len, GFP_ATOMIC);
|
p->pe_data = kmemdup(pe_data, pe_data_len, GFP_ATOMIC);
|
||||||
if (!p->pe_data) {
|
if (!p->pe_data) {
|
||||||
if (p->pe->module)
|
module_put(p->pe->module);
|
||||||
module_put(p->pe->module);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
p->pe_data_len = pe_data_len;
|
p->pe_data_len = pe_data_len;
|
||||||
|
|||||||
@@ -3674,8 +3674,7 @@ static int nf_tables_abort(struct sk_buff *skb)
|
|||||||
break;
|
break;
|
||||||
case NFT_MSG_NEWCHAIN:
|
case NFT_MSG_NEWCHAIN:
|
||||||
if (nft_trans_chain_update(trans)) {
|
if (nft_trans_chain_update(trans)) {
|
||||||
if (nft_trans_chain_stats(trans))
|
free_percpu(nft_trans_chain_stats(trans));
|
||||||
free_percpu(nft_trans_chain_stats(trans));
|
|
||||||
|
|
||||||
nft_trans_destroy(trans);
|
nft_trans_destroy(trans);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user