Commit 031d7709 authored by Tony Zelenoff's avatar Tony Zelenoff Committed by Pablo Neira Ayuso

netfilter: nf_ct_ecache: refactor notifier registration

* ret variable initialization removed as useless
* similar code strings concatenated and functions code
  flow became more plain
Signed-off-by: default avatarTony Zelenoff <antonz@parallels.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 97138a1c
...@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); ...@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events);
int nf_conntrack_register_notifier(struct net *net, int nf_conntrack_register_notifier(struct net *net,
struct nf_ct_event_notifier *new) struct nf_ct_event_notifier *new)
{ {
int ret = 0; int ret;
struct nf_ct_event_notifier *notify; struct nf_ct_event_notifier *notify;
mutex_lock(&nf_ct_ecache_mutex); mutex_lock(&nf_ct_ecache_mutex);
...@@ -95,8 +95,7 @@ int nf_conntrack_register_notifier(struct net *net, ...@@ -95,8 +95,7 @@ int nf_conntrack_register_notifier(struct net *net,
goto out_unlock; goto out_unlock;
} }
rcu_assign_pointer(net->ct.nf_conntrack_event_cb, new); rcu_assign_pointer(net->ct.nf_conntrack_event_cb, new);
mutex_unlock(&nf_ct_ecache_mutex); ret = 0;
return ret;
out_unlock: out_unlock:
mutex_unlock(&nf_ct_ecache_mutex); mutex_unlock(&nf_ct_ecache_mutex);
...@@ -121,7 +120,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); ...@@ -121,7 +120,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier);
int nf_ct_expect_register_notifier(struct net *net, int nf_ct_expect_register_notifier(struct net *net,
struct nf_exp_event_notifier *new) struct nf_exp_event_notifier *new)
{ {
int ret = 0; int ret;
struct nf_exp_event_notifier *notify; struct nf_exp_event_notifier *notify;
mutex_lock(&nf_ct_ecache_mutex); mutex_lock(&nf_ct_ecache_mutex);
...@@ -132,8 +131,7 @@ int nf_ct_expect_register_notifier(struct net *net, ...@@ -132,8 +131,7 @@ int nf_ct_expect_register_notifier(struct net *net,
goto out_unlock; goto out_unlock;
} }
rcu_assign_pointer(net->ct.nf_expect_event_cb, new); rcu_assign_pointer(net->ct.nf_expect_event_cb, new);
mutex_unlock(&nf_ct_ecache_mutex); ret = 0;
return ret;
out_unlock: out_unlock:
mutex_unlock(&nf_ct_ecache_mutex); mutex_unlock(&nf_ct_ecache_mutex);
......
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