diff mbox series

[next] net: microchip: sparx5: remove redundant store to variable clk_hz

Message ID 20240116161847.2317011-1-colin.i.king@gmail.com (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series [next] net: microchip: sparx5: remove redundant store to variable clk_hz | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1092 this patch: 1092
netdev/cc_maintainers success CCed 0 of 0 maintainers
netdev/build_clang success Errors and warnings before: 1107 this patch: 1107
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1107 this patch: 1107
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest pending net-next-2024-01-17--00-00

Commit Message

Colin Ian King Jan. 16, 2024, 4:18 p.m. UTC
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(-)

Comments

Jakub Kicinski Jan. 17, 2024, 1:53 a.m. UTC | #1
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/
diff mbox series

Patch

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,