Commit a925316a authored by zuoqilin's avatar zuoqilin Committed by Steffen Klassert

net: Remove unnecessary variables

It is not necessary to define variables to receive -ENOMEM,
directly return -ENOMEM.
Signed-off-by: default avatarzuoqilin <zuoqilin@yulong.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent fe9f1d87
...@@ -141,7 +141,6 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol, ...@@ -141,7 +141,6 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol,
struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id); struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id);
struct sock *sk; struct sock *sk;
struct pfkey_sock *pfk; struct pfkey_sock *pfk;
int err;
if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM; return -EPERM;
...@@ -150,10 +149,9 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol, ...@@ -150,10 +149,9 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol,
if (protocol != PF_KEY_V2) if (protocol != PF_KEY_V2)
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
err = -ENOMEM;
sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto, kern); sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto, kern);
if (sk == NULL) if (sk == NULL)
goto out; return -ENOMEM;
pfk = pfkey_sk(sk); pfk = pfkey_sk(sk);
mutex_init(&pfk->dump_lock); mutex_init(&pfk->dump_lock);
...@@ -169,8 +167,6 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol, ...@@ -169,8 +167,6 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol,
pfkey_insert(sk); pfkey_insert(sk);
return 0; return 0;
out:
return err;
} }
static int pfkey_release(struct socket *sock) static int pfkey_release(struct socket *sock)
......
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