Skip to contentSkip to conversation

net: phy: fix a return path in get_phy_c45_ids()

PATCH Applied Charles Perry 3 participants 3 messages Apr 9 – Apr 12

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: phy: fix a return path in get_phy_c45_ids()

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")

---

Notes:
Changes in v2:
- Collect Andrew's Reviewed-by
- Send to net instead of net-next
- fix one typo in the commit message

 drivers/net/phy/phy_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/phy_device.c +2 -2
index 81984d4ebb7c..810327fa886a 100644
@@ -973,8 +973,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;
Signature · 1 line
2.47.3
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Charles Perry

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")

Thanks!

Note: you don't need to resend just because you've received another r-b.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#2 lore raw
In reply to Charles Perry
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Thu, 9 Apr 2026 06:36:54 -0700 you wrote:

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")

[...]

Here is the summary with links:
- [net,v2] net: phy: fix a return path in get_phy_c45_ids()

    https://git.kernel.org/netdev/net/c/6f533abe7bba

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html