net: phy: ensure that phy IDs are correctly typed
Subsystems (3)
PATCH 1/1 net: phy: ensure that phy IDs are correctly typed
PHY IDs are 32-bit unsigned quantities. Ensure that they are always treated as such, and not passed around as "int"s.
--- drivers/net/phy/phy_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +1 -1
@@ -551,7 +551,7 @@ static const struct device_type mdio_bus_phy_type = { .pm = MDIO_BUS_PHY_PM_OPS, }; -static int phy_request_driver_module (struct phy_device *dev,int phy_id) +static int phy_request_driver_module (struct phy_device *dev,u32 phy_id) {int ret;
Signature · 1 line
2.20.1
Russell King - ARM Linux admin
reviewerQuoted 4 lines · Russell King
PHY IDs are 32-bit unsigned quantities. Ensure that they are always treated as such, and not passed around as "int"s.
Signed-off-by Russell King <[email protected]>
Quoted 21 lines
--- drivers/net/phy/phy_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/phy/phy_device.c +1
-1@@ -551,7 +551,7 @@ static const struct device_type mdio_bus_phy_type = { .pm = MDIO_BUS_PHY_PM_OPS, }; -static int phy_request_driver_module (struct phy_device *dev,int phy_id) +static int phy_request_driver_module (struct phy_device *dev,u32 phy_id) {int ret;Signature · 1 line
2.20.1
Signature · 3 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up
Andrew Lunn
maintainerQuoted 2 lines · Russell King
PHY IDs are 32-bit unsigned quantities. Ensure that they are always treated as such, and not passed around as "int"s.
Hi Russell
Do we want to fix all cases?
struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
Andrew
Russell King - ARM Linux admin
reviewerQuoted 9 lines · Andrew Lunn
Quoted 2 lines · Russell King
PHY IDs are 32-bit unsigned quantities. Ensure that they are always treated as such, and not passed around as "int"s.
Hi Russell
Do we want to fix all cases?
struct
phy_device*phy_device_create(structmii_bus*bus, int addr, intphy_id,
There's also the format specifier in phydev_err() - we already have one instance where we case the u32 to unsigned long in order to get a consistent type that is large enough to print without any issues.
Revised patch on its way.
Signature · 3 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up