Commit 982f4051 authored by Markus Elfring's avatar Markus Elfring Committed by Pablo Neira Ayuso

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
Acked-by: default avatarSimon Horman <horms@verge.net.au>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 2c7b5d5d
......@@ -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)
{
if (svc->stats.cpustats)
free_percpu(svc->stats.cpustats);
free_percpu(svc->stats.cpustats);
kfree(svc);
}
......
......@@ -37,8 +37,7 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name)
rcu_read_unlock();
return pe;
}
if (pe->module)
module_put(pe->module);
module_put(pe->module);
}
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);
return sched;
}
if (sched->module)
module_put(sched->module);
module_put(sched->module);
}
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);
if (!p->pe_data) {
if (p->pe->module)
module_put(p->pe->module);
module_put(p->pe->module);
return -ENOMEM;
}
p->pe_data_len = pe_data_len;
......
......@@ -3674,8 +3674,7 @@ static int nf_tables_abort(struct sk_buff *skb)
break;
case NFT_MSG_NEWCHAIN:
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);
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment