netns: simplify net_ns_init
The net_ns_init code can be simplified. No need to save error code if it is only going to panic if it is set 4 lines later. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
1f7a2bb4ef
commit
ca0f31125c
@@ -196,7 +196,6 @@ struct net *copy_net_ns(unsigned long flags, struct net *old_net)
|
|||||||
static int __init net_ns_init(void)
|
static int __init net_ns_init(void)
|
||||||
{
|
{
|
||||||
struct net_generic *ng;
|
struct net_generic *ng;
|
||||||
int err;
|
|
||||||
|
|
||||||
#ifdef CONFIG_NET_NS
|
#ifdef CONFIG_NET_NS
|
||||||
net_cachep = kmem_cache_create("net_namespace", sizeof(struct net),
|
net_cachep = kmem_cache_create("net_namespace", sizeof(struct net),
|
||||||
@@ -216,15 +215,14 @@ static int __init net_ns_init(void)
|
|||||||
rcu_assign_pointer(init_net.gen, ng);
|
rcu_assign_pointer(init_net.gen, ng);
|
||||||
|
|
||||||
mutex_lock(&net_mutex);
|
mutex_lock(&net_mutex);
|
||||||
err = setup_net(&init_net);
|
if (setup_net(&init_net))
|
||||||
|
panic("Could not setup the initial network namespace");
|
||||||
|
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
list_add_tail(&init_net.list, &net_namespace_list);
|
list_add_tail(&init_net.list, &net_namespace_list);
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
|
|
||||||
mutex_unlock(&net_mutex);
|
mutex_unlock(&net_mutex);
|
||||||
if (err)
|
|
||||||
panic("Could not setup the initial network namespace");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user