Skip to contentSkip to conversation

net/velocity: fix -Wunused-but-set-variable warnings

PATCH In review Austin Kim 2 participants 2 messages Oct 4, 2019

Subsystems (3)
lore
Share & tools
lore

Austin Kim

author
#0 lore raw

PATCH 1/1 net/velocity: fix -Wunused-but-set-variable warnings

'curr_status' is declared as u32.
But this variable is not used after below statement.
curr_status = vptr->mii_status & (~VELOCITY_LINK_FAIL);

This variable could be dropped to mute below warning message:

drivers/net/ethernet/via/via-velocity.c:868:6:
warning: variable ‘curr_status’ set but not used [-Wunused-but-set-variable]

---
 drivers/net/ethernet/via/via-velocity.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/via/via-velocity.c +0 -2
index 346e441..36d402c 100644
@@ -865,11 +865,9 @@ static u32 check_connection_type(struct mac_regs __iomem *regs)
  */
 static int velocity_set_media_mode(struct velocity_info *vptr, u32 mii_status)
 {
-	u32 curr_status;
 	struct mac_regs __iomem *regs = vptr->mac_regs;
 
 	vptr->mii_status = mii_check_media_mode(vptr->mac_regs);
-	curr_status = vptr->mii_status & (~VELOCITY_LINK_FAIL);
 
 	/* Set mii link status */
 	set_mii_flow_control(vptr);
Signature · 1 line
2.6.2
maintainer
#1 lore raw

From: Austin Kim <[email protected]>
Date: Fri, 4 Oct 2019 13:52:03 +0900

Quoted 11 lines

'curr_status' is declared as u32.
But this variable is not used after below statement.
curr_status = vptr->mii_status & (~VELOCITY_LINK_FAIL);

This variable could be dropped to mute below warning message:

drivers/net/ethernet/via/via-velocity.c:868:6:
warning: variable ‘curr_status’ set but not used [-Wunused-but-set-variable]

Please don't make these changes like a robot.

Always look at the surrounding context and even the history of how this piece of code got here by using git blame and other tools.

There is a comment right under this variable assignment referring to the variable. So if you remove the variable, you should do something with the comment as well.

Thank you.