]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: phy: fix a return path in get_phy_c45_ids()
authorCharles Perry <charles.perry@microchip.com>
Thu, 9 Apr 2026 13:36:54 +0000 (06:36 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sun, 12 Apr 2026 21:16:05 +0000 (14:16 -0700)
The return value of phy_c45_probe_present() is stored in "ret", not
"phy_reg", fix this. "phy_reg" always has a positive value if we reach
this return path (since it would have returned earlier otherwise), which
means that the original goal of the patch of not considering -ENODEV
fatal wasn't achieved.

Fixes: 17b447539408 ("net: phy: c45 scanning: Don't consider -ENODEV fatal")
Signed-off-by: Charles Perry <charles.perry@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/20260409133654.3203336-1-charles.perry@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phy_device.c

index 3bd415710bf3f8261c5b2afa2c93079542e8efaf..f3696d9819d35141210a7b07b3f8fc11135b8629 100644 (file)
@@ -927,8 +927,8 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr,
                                /* returning -ENODEV doesn't stop bus
                                 * scanning
                                 */
-                               return (phy_reg == -EIO ||
-                                       phy_reg == -ENODEV) ? -ENODEV : -EIO;
+                               return (ret == -EIO ||
+                                       ret == -ENODEV) ? -ENODEV : -EIO;
 
                        if (!ret)
                                continue;