Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -465,7 +465,6 @@ __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);
	kfree(svc);
}
+1 −2
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name)
			rcu_read_unlock();
			return pe;
		}
		if (pe->module)
		module_put(pe->module);
	}
	rcu_read_unlock();
+1 −2
Original line number Diff line number Diff line
@@ -104,7 +104,6 @@ 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);
	}

+1 −2
Original line number Diff line number Diff line
@@ -820,7 +820,6 @@ 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);
			return -ENOMEM;
		}
+1 −2
Original line number Diff line number Diff line
@@ -3674,7 +3674,6 @@ 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));

				nft_trans_destroy(trans);