summaryrefslogtreecommitdiffstats
path: root/net/key
diff options
context:
space:
mode:
authorzuoqilin <zuoqilin@yulong.com>2021-05-14 15:55:13 +0800
committerSteffen Klassert <steffen.klassert@secunet.com>2021-05-26 07:03:39 +0200
commita925316af80ae93186f00d80163f5a3c7f5b4782 (patch)
treecb0daaabab4d954703846bb209c5b0e12688aecc /net/key
parentfe9f1d8779cb47046e76ea209b6eece7ec56d1b4 (diff)
downloadlinux-stable-a925316af80ae93186f00d80163f5a3c7f5b4782.tar.gz
linux-stable-a925316af80ae93186f00d80163f5a3c7f5b4782.tar.bz2
linux-stable-a925316af80ae93186f00d80163f5a3c7f5b4782.zip
net: Remove unnecessary variables
It is not necessary to define variables to receive -ENOMEM, directly return -ENOMEM. Signed-off-by: zuoqilin <zuoqilin@yulong.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/key')
-rw-r--r--net/key/af_key.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index ef9b4ac03e7b..de24a7d474df 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -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 sock *sk;
struct pfkey_sock *pfk;
- int err;
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
return -EPERM;
@@ -150,10 +149,9 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol,
if (protocol != PF_KEY_V2)
return -EPROTONOSUPPORT;
- err = -ENOMEM;
sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto, kern);
if (sk == NULL)
- goto out;
+ return -ENOMEM;
pfk = pfkey_sk(sk);
mutex_init(&pfk->dump_lock);
@@ -169,8 +167,6 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol,
pfkey_insert(sk);
return 0;
-out:
- return err;
}
static int pfkey_release(struct socket *sock)