tg3: Use *_UNKNOWN ethtool definitions
Subsystems (2)
Hello Matt Carlson,
The patch e740522e6d3a: "tg3: Use *_UNKNOWN ethtool definitions" from Feb 13, 2012, leads to the following Smatch warning:drivers/net/ethernet/broadcom/tg3.c:1822 tg3_adjust_link()
error: tp->link_config.active_speed is never equal to -1 (wrong type 0 - 65535).
- if ((phydev->link && tp->link_config.active_speed == SPEED_INVALID) || - (!phydev->link && tp->link_config.active_speed != SPEED_INVALID) || + if ((phydev->link && tp->link_config.active_speed == SPEED_UNKNOWN) || + (!phydev->link && tp->link_config.active_speed != SPEED_UNKNOWN) ||
Since tp->link_config.active_speed is an unsigned short, it never is equal to SPEED_UNKNOWN (-1).
I introduced the SPEED_UNKNOWN so I feel bad that it's causing trouble now. :/
Also this warning:drivers/net/ethernet/broadcom/tg3.c:3909 tg3_phy_copper_begin(14)
error: tp->link_config.speed is never equal to -1 (wrong type 0 - 65535).
regards,
dan carpenter
Quoted 15 lines · Dan Carpenter
Hello Matt Carlson,
The patch
e740522e6d3a: "tg3: Use*_UNKNOWNethtool definitions" from Feb 13, 2012, leads to the following Smatch warning:drivers/net/ethernet/broadcom/tg3.c:1822tg3_adjust_link()error: tp->link_config.active_speed is never equal to -1 (wrong type 0 - 65535).(quoted diff) +2
-2- if ((phydev->link && tp->link_config.active_speed == SPEED_INVALID) || - (!phydev->link && tp->link_config.active_speed != SPEED_INVALID) || + if ((phydev->link && tp->link_config.active_speed == SPEED_UNKNOWN) || + (!phydev->link && tp->link_config.active_speed != SPEED_UNKNOWN) ||Since
tp->link_config.active_speedis an unsigned short, it never is equal toSPEED_UNKNOWN(-1).
Quoted 6 lines
I introduced the
SPEED_UNKNOWNso I feel bad that it's causing trouble now. :/Also this warning:
drivers/net/ethernet/broadcom/tg3.c:3909tg3_phy_copper_begin(14)
error:tp->link_config.speedis never equal to -1 (wrong type 0 - 65535).
Do you have any problems with changing SPEED_UNKNOWN from -1 to 0xffff?
Quoted 16 lines · Matt Carlson
Quoted 15 lines · Dan Carpenter
Hello Matt Carlson,
The patch
e740522e6d3a: "tg3: Use*_UNKNOWNethtool definitions" from Feb 13, 2012, leads to the following Smatch warning:drivers/net/ethernet/broadcom/tg3.c:1822tg3_adjust_link()error: tp->link_config.active_speed is never equal to -1 (wrong type 0 - 65535).(quoted diff) +2
-2- if ((phydev->link && tp->link_config.active_speed == SPEED_INVALID) || - (!phydev->link && tp->link_config.active_speed != SPEED_INVALID) || + if ((phydev->link && tp->link_config.active_speed == SPEED_UNKNOWN) || + (!phydev->link && tp->link_config.active_speed != SPEED_UNKNOWN) ||Since
tp->link_config.active_speedis an unsigned short, it never is equal toSPEED_UNKNOWN(-1).
Quoted 8 lines
Quoted 6 lines
I introduced the
SPEED_UNKNOWNso I feel bad that it's causing trouble now. :/Also this warning:
drivers/net/ethernet/broadcom/tg3.c:3909tg3_phy_copper_begin(14)
error:tp->link_config.speedis never equal to -1 (wrong type 0 - 65535).Do you have any problems with changing
SPEED_UNKNOWNfrom -1 to0xffff?
I have a big problem with that - speed values are 32-bit in the ethtool API.
Ben.
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.