Skip to contentSkip to conversation

net: ksz884x: remove unused change variable

PATCH Applied Tom Rix 3 participants 4 messages Mar 29, 2023 – Mar 31, 2023

Subsystems (2)
lore
Share & tools
lore

Tom Rix

author
#0 lore raw

PATCH 1/1 net: ksz884x: remove unused change variable

clang with W=1 reports drivers/net/ethernet/micrel/ksz884x.c:3216:6: error: variable
'change' set but not used [-Werror,-Wunused-but-set-variable]

        int change = 0;
            ^

This variable is not used so remove it.

---
 drivers/net/ethernet/micrel/ksz884x.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/net/ethernet/micrel/ksz884x.c +3 -7
index e6acd1e7b263..f78e8ead8c36 100644
@@ -3213,7 +3213,6 @@ static void port_get_link_speed(struct ksz_port *port)
 	u8 remote;
 	int i;
 	int p;
-	int change = 0;
 
 	interrupt = hw_block_intr(hw);
 
@@ -3260,17 +3259,14 @@ static void port_get_link_speed(struct ksz_port *port)
 					port_cfg_back_pressure(hw, p,
 						(1 == info->duplex));
 				}
-				change |= 1 << i;
 				port_cfg_change(hw, port, info, status);
 			}
 			info->state = media_connected;
 		} else {
-			if (media_disconnected != info->state) {
-				change |= 1 << i;
-
-				/* Indicate the link just goes down. */
+			/* Indicate the link just goes down. */
+			if (media_disconnected != info->state)
 				hw->port_mib[p].link_down = 1;
-			}
+
 			info->state = media_disconnected;
 		}
 		hw->port_mib[p].state = (u8) info->state;
Signature · 1 line
2.27.0
#2 lore raw
Quoted 11 lines · Simon Horman
Quoted 8 lines · Tom Rix

clang with W=1 reports drivers/net/ethernet/micrel/ksz884x.c:3216:6: error: variable
'change' set but not used [-Werror,-Wunused-but-set-variable]

        int change = 0;
            ^

This variable is not used so remove it.

Hi Tom,

I notice a very large number of unused functions in ksz884x.c. And I think this means some corresponding #defines can also be removed.

I'm wondering if you happen to be looking at this. If not, I'll see about preparing a patch.

#3 lore raw
In reply to Tom Rix
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 29 Mar 2023 08:59:29 -0400 you wrote:

clang with W=1 reports drivers/net/ethernet/micrel/ksz884x.c:3216:6: error: variable
'change' set but not used [-Werror,-Wunused-but-set-variable]

        int change = 0;
            ^

This variable is not used so remove it.

[...]

Here is the summary with links:
- net: ksz884x: remove unused change variable

    https://git.kernel.org/netdev/net-next/c/9a865a98a336

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html