[linux-next] net: af_key: remove redundant ret variable

Message ID 202211022146335400497@zte.com.cn
State New
Headers
Series [linux-next] net: af_key: remove redundant ret variable |

Commit Message

zhang.songyi@zte.com.cn Nov. 2, 2022, 1:46 p.m. UTC
  From a09ddf4bd144610fd17bdbf07f0c27700d805e6f Mon Sep 17 00:00:00 2001
From: zhang songyi <zhang.songyi@zte.com.cn>
Date: Wed, 2 Nov 2022 21:05:39 +0800
Subject: [PATCH linux-next] net: af_key: remove redundant ret variable

Return value from pfkey_net_init() directly instead of taking this in
another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>
---
 net/key/af_key.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--
2.15.2
  

Comments

Steffen Klassert Nov. 14, 2022, 6:43 a.m. UTC | #1
On Wed, Nov 02, 2022 at 09:46:33PM +0800, zhang.songyi@zte.com.cn wrote:
> >From a09ddf4bd144610fd17bdbf07f0c27700d805e6f Mon Sep 17 00:00:00 2001
> From: zhang songyi <zhang.songyi@zte.com.cn>
> Date: Wed, 2 Nov 2022 21:05:39 +0800
> Subject: [PATCH linux-next] net: af_key: remove redundant ret variable
> 
> Return value from pfkey_net_init() directly instead of taking this in
> another redundant variable.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>

pfkey is deprecated and should not be used anymore.
Please do changes to pfkey just if there is a real
bug to fix.

Thanks!
  

Patch

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 213287814328..ec37825b1c15 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3863,14 +3863,11 @@  static struct xfrm_mgr pfkeyv2_mgr =
 static int __net_init pfkey_net_init(struct net *net)
 {
    struct netns_pfkey *net_pfkey = net_generic(net, pfkey_net_id);
-   int rv;

    INIT_HLIST_HEAD(&net_pfkey->table);
    atomic_set(&net_pfkey->socks_nr, 0);

-   rv = pfkey_init_proc(net);
-
-   return rv;
+   return pfkey_init_proc(net);
 }

 static void __net_exit pfkey_net_exit(struct net *net)