[PATCH] net: Remove unnecessary variables

Subsystems: can network layer, the rest

STALE1911d LANDED

Landed in mainline as 24a774a4f975 on 2021-05-27.

2 messages, 2 authors, 2021-05-14 · open the first message on its own page

[PATCH] net: Remove unnecessary variables

From: <hidden>
Date: 2021-05-14 10:09:06

From: zuoqilin <redacted>

There is no need to define the variable "rate" to receive,
just return directly.

Signed-off-by: zuoqilin <redacted>
---
 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

Re: [PATCH] net: Remove unnecessary variables

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-05-14 20:41:15

On 14.05.2021 18:08:06, zuoqilin1@163.com wrote:
From: zuoqilin <redacted>

There is no need to define the variable "rate" to receive,
just return directly.

Signed-off-by: zuoqilin <redacted>
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 |
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help