From 1f60789602e0d5f5f9a8b507f25737c65b5d8daa Mon Sep 17 00:00:00 2001 From: Priyanka Jain Date: Tue, 5 Nov 2019 04:05:11 +0000 Subject: [PATCH] net/phy: Fix phy_connect() for phy addr 0 Fix 'mask' calculation in phy_connect() for phy addr '0'. 'mask' is getting set to '0xffffffff' for phy addr '0' in phy_connect() whereas expected value is '0'. Signed-off-by: Priyanka Jain Reported-by: tetsu-aoki via github Acked-by: Joe Hershberger --- drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index f2d17aa..6be0709 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -997,7 +997,7 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr, #endif { struct phy_device *phydev = NULL; - uint mask = (addr > 0) ? (1 << addr) : 0xffffffff; + uint mask = (addr >= 0) ? (1 << addr) : 0xffffffff; #ifdef CONFIG_PHY_FIXED phydev = phy_connect_fixed(bus, dev, interface); -- 2.7.4