* [PATCH][next] net: microchip: sparx5: remove redundant store to variable clk_hz
@ 2024-01-16 16:18 Colin Ian King
2024-01-17 1:53 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2024-01-16 16:18 UTC (permalink / raw)
To: David S . Miller, Eric Dumazet, Paolo Abeni, Lars Povlsen,
Steen Hegelund, UNGLinuxDriver, netdev, linux-arm-kernel
Cc: kernel-janitors, linux-kernel
The store to clk_hz is redundant since clk_hz goes out of scope on the
return. Fix this by replacing the *= operator with just * to remove
the store back to clk_hz.
Cleans up clang scan build warning:
warning: Although the value stored to 'clk_hz' is used in the enclosing
expression, the value is never actually read from 'clk_hz'
[deadcode.DeadStores]
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/net/ethernet/microchip/sparx5/sparx5_sdlb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_sdlb.c b/drivers/net/ethernet/microchip/sparx5/sparx5_sdlb.c
index f5267218caeb..d8f49082dbe4 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_sdlb.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_sdlb.c
@@ -31,7 +31,7 @@ int sparx5_sdlb_clk_hz_get(struct sparx5 *sparx5)
clk_per_100ps = SPX5_CLK_PER_100PS_DEFAULT;
clk_hz = (10 * 1000 * 1000) / clk_per_100ps;
- return clk_hz *= 1000;
+ return clk_hz * 1000;
}
static int sparx5_sdlb_pup_interval_get(struct sparx5 *sparx5, u32 max_token,
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] net: microchip: sparx5: remove redundant store to variable clk_hz
2024-01-16 16:18 [PATCH][next] net: microchip: sparx5: remove redundant store to variable clk_hz Colin Ian King
@ 2024-01-17 1:53 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2024-01-17 1:53 UTC (permalink / raw)
To: Colin Ian King
Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Lars Povlsen,
Steen Hegelund, UNGLinuxDriver, netdev, linux-arm-kernel,
kernel-janitors, linux-kernel
On Tue, 16 Jan 2024 16:18:47 +0000 Colin Ian King wrote:
> The store to clk_hz is redundant since clk_hz goes out of scope on the
> return. Fix this by replacing the *= operator with just * to remove
> the store back to clk_hz.
>
> Cleans up clang scan build warning:
> warning: Although the value stored to 'clk_hz' is used in the enclosing
> expression, the value is never actually read from 'clk_hz'
> [deadcode.DeadStores]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
For consistency - same story as:
https://lore.kernel.org/all/20240116193152.GD588419@kernel.org/
--
pw-bot: defer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-17 1:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-16 16:18 [PATCH][next] net: microchip: sparx5: remove redundant store to variable clk_hz Colin Ian King
2024-01-17 1:53 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).