* [PATCH] net: phy: ensure that phy IDs are correctly typed
@ 2019-12-19 10:20 Russell King
2019-12-19 10:24 ` Russell King - ARM Linux admin
2019-12-19 21:01 ` Andrew Lunn
0 siblings, 2 replies; 4+ messages in thread
From: Russell King @ 2019-12-19 10:20 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Heiner Kallweit; +Cc: David S. Miller, netdev
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 <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index daaeae5f2d96..68d4d49286d7 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -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;
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: phy: ensure that phy IDs are correctly typed
2019-12-19 10:20 [PATCH] net: phy: ensure that phy IDs are correctly typed Russell King
@ 2019-12-19 10:24 ` Russell King - ARM Linux admin
2019-12-19 21:01 ` Andrew Lunn
1 sibling, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux admin @ 2019-12-19 10:24 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, Heiner Kallweit; +Cc: David S. Miller, netdev
On Thu, Dec 19, 2019 at 10:20:48AM +0000, Russell King wrote:
> 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 <rmk+kernel@armlinux.org.uk>
Fixes: 13d0ab6750b2 ("net: phy: check return code when requesting PHY driver module")
> ---
> drivers/net/phy/phy_device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index daaeae5f2d96..68d4d49286d7 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -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;
>
> --
> 2.20.1
>
>
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: phy: ensure that phy IDs are correctly typed
2019-12-19 10:20 [PATCH] net: phy: ensure that phy IDs are correctly typed Russell King
2019-12-19 10:24 ` Russell King - ARM Linux admin
@ 2019-12-19 21:01 ` Andrew Lunn
2019-12-19 22:40 ` Russell King - ARM Linux admin
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2019-12-19 21:01 UTC (permalink / raw)
To: Russell King; +Cc: Florian Fainelli, Heiner Kallweit, David S. Miller, netdev
On Thu, Dec 19, 2019 at 10:20:48AM +0000, Russell King wrote:
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: phy: ensure that phy IDs are correctly typed
2019-12-19 21:01 ` Andrew Lunn
@ 2019-12-19 22:40 ` Russell King - ARM Linux admin
0 siblings, 0 replies; 4+ messages in thread
From: Russell King - ARM Linux admin @ 2019-12-19 22:40 UTC (permalink / raw)
To: Andrew Lunn; +Cc: Florian Fainelli, Heiner Kallweit, David S. Miller, netdev
On Thu, Dec 19, 2019 at 10:01:00PM +0100, Andrew Lunn wrote:
> On Thu, Dec 19, 2019 at 10:20:48AM +0000, Russell King wrote:
> > 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,
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.
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-19 22:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19 10:20 [PATCH] net: phy: ensure that phy IDs are correctly typed Russell King
2019-12-19 10:24 ` Russell King - ARM Linux admin
2019-12-19 21:01 ` Andrew Lunn
2019-12-19 22:40 ` Russell King - ARM Linux admin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.