* [PATCH] net: Remove unnecessary variables
@ 2021-05-14 7:55 zuoqilin1
2021-05-27 10:22 ` Steffen Klassert
0 siblings, 1 reply; 4+ messages in thread
From: zuoqilin1 @ 2021-05-14 7:55 UTC (permalink / raw)
To: steffen.klassert, herbert, davem, kuba; +Cc: netdev, linux-kernel, zuoqilin
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>
---
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 ef9b4ac..de24a7d 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)
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: Remove unnecessary variables
2021-05-14 7:55 [PATCH] net: Remove unnecessary variables zuoqilin1
@ 2021-05-27 10:22 ` Steffen Klassert
0 siblings, 0 replies; 4+ messages in thread
From: Steffen Klassert @ 2021-05-27 10:22 UTC (permalink / raw)
To: zuoqilin1; +Cc: herbert, davem, kuba, netdev, linux-kernel, zuoqilin
On Fri, May 14, 2021 at 03:55:13PM +0800, zuoqilin1@163.com wrote:
> 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>
Applied to ipsec-next, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: Remove unnecessary variables
2021-05-14 10:08 zuoqilin1
@ 2021-05-14 20:40 ` Marc Kleine-Budde
0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-05-14 20:40 UTC (permalink / raw)
To: zuoqilin1
Cc: socketcan, davem, kuba, linux-can, netdev, linux-kernel, zuoqilin
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
On 14.05.2021 18:08:06, zuoqilin1@163.com wrote:
> From: zuoqilin <zuoqilin@yulong.com>
>
> There is no need to define the variable "rate" to receive,
> just return directly.
>
> Signed-off-by: zuoqilin <zuoqilin@yulong.com>
Applied to linux-can-next/testing.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] net: Remove unnecessary variables
@ 2021-05-14 10:08 zuoqilin1
2021-05-14 20:40 ` Marc Kleine-Budde
0 siblings, 1 reply; 4+ messages in thread
From: zuoqilin1 @ 2021-05-14 10:08 UTC (permalink / raw)
To: socketcan, mkl, davem, kuba; +Cc: linux-can, netdev, linux-kernel, zuoqilin
From: zuoqilin <zuoqilin@yulong.com>
There is no need to define the variable "rate" to receive,
just return directly.
Signed-off-by: zuoqilin <zuoqilin@yulong.com>
---
net/can/proc.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/net/can/proc.c b/net/can/proc.c
index d1fe49e..b3099f0 100644
--- a/net/can/proc.c
+++ b/net/can/proc.c
@@ -99,8 +99,6 @@ static void can_init_stats(struct net *net)
static unsigned long calc_rate(unsigned long oldjif, unsigned long newjif,
unsigned long count)
{
- unsigned long rate;
-
if (oldjif == newjif)
return 0;
@@ -111,9 +109,7 @@ static unsigned long calc_rate(unsigned long oldjif, unsigned long newjif,
return 99999999;
}
- rate = (count * HZ) / (newjif - oldjif);
-
- return rate;
+ return (count * HZ) / (newjif - oldjif);
}
void can_stat_update(struct timer_list *t)
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-27 10:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 7:55 [PATCH] net: Remove unnecessary variables zuoqilin1
2021-05-27 10:22 ` Steffen Klassert
2021-05-14 10:08 zuoqilin1
2021-05-14 20:40 ` Marc Kleine-Budde
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.