All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: David Miller <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	<netdev@vger.kernel.org>
Subject: [PATCH 03/17] net: Remove unnecessary variables
Date: Mon, 28 Jun 2021 07:45:08 +0200	[thread overview]
Message-ID: <20210628054522.1718786-4-steffen.klassert@secunet.com> (raw)
In-Reply-To: <20210628054522.1718786-1-steffen.klassert@secunet.com>

From: zuoqilin <zuoqilin@yulong.com>

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>
---
 net/key/af_key.c | 6 +-----
 1 file changed, 1 insertion(+), 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)
-- 
2.25.1


  parent reply	other threads:[~2021-06-28  5:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28  5:45 pull request (net-next): ipsec-next 2021-06-28 Steffen Klassert
2021-06-28  5:45 ` [PATCH 01/17] esp: drop unneeded assignment in esp4_gro_receive() Steffen Klassert
2021-06-28 20:40   ` patchwork-bot+netdevbpf
2021-06-28  5:45 ` [PATCH 02/17] xfrm: add state hashtable keyed by seq Steffen Klassert
2021-06-28  5:45 ` Steffen Klassert [this message]
2021-06-28  5:45 ` [PATCH 04/17] xfrm: remove description from xfrm_type struct Steffen Klassert
2021-06-28  5:45 ` [PATCH 05/17] xfrm: policy: fix a spelling mistake Steffen Klassert
2021-06-28  5:45 ` [PATCH 06/17] xfrm: ipv6: add xfrm6_hdr_offset helper Steffen Klassert
2021-06-28  5:45 ` [PATCH 07/17] xfrm: ipv6: move mip6_destopt_offset into xfrm core Steffen Klassert
2021-06-28  5:45 ` [PATCH 08/17] xfrm: ipv6: move mip6_rthdr_offset " Steffen Klassert
2021-06-28  5:45 ` [PATCH 09/17] xfrm: remove hdr_offset indirection Steffen Klassert
2021-06-28  5:45 ` [PATCH 10/17] xfrm: merge dstopt and routing hdroff functions Steffen Klassert
2021-06-28  5:45 ` [PATCH 11/17] xfrm: delete xfrm4_output_finish xfrm6_output_finish declarations Steffen Klassert
2021-06-28  5:45 ` [PATCH 12/17] xfrm: avoid compiler warning when ipv6 is disabled Steffen Klassert
2021-06-28  5:45 ` [PATCH 13/17] xfrm: replay: avoid xfrm replay notify indirection Steffen Klassert
2021-06-28  5:45 ` [PATCH 14/17] xfrm: replay: remove advance indirection Steffen Klassert
2021-06-28  5:45 ` [PATCH 15/17] xfrm: replay: remove recheck indirection Steffen Klassert
2021-06-28  5:45 ` [PATCH 16/17] xfrm: replay: avoid replay indirection Steffen Klassert
2021-06-28  5:45 ` [PATCH 17/17] xfrm: replay: remove last " Steffen Klassert
2021-06-28 20:40 ` pull request (net-next): ipsec-next 2021-06-28 patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210628054522.1718786-4-steffen.klassert@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.