[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250910025826.3484607-1-yicongsrfy@163.com>
Date: Wed, 10 Sep 2025 10:58:26 +0800
From: yicongsrfy@....com
To: andrew@...n.ch,
hkallweit1@...il.com,
linux@...linux.org.uk
Cc: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
yicong@...inos.cn
Subject: [PATCH] net: phy: avoid config_init failure on unattached PHY during resume
From: Yi Cong <yicong@...inos.cn>
When resuming a PHY device that is not attached to a MAC (i.e.
phydev->attached_dev is NULL), mdio_bus_phy_resume() may call into
phy_init_hw() -> phydev->drv->config_init(), which can return -EOPNOTSUPP
(-95) if the driver does not support initialization in this state.
This results in log messages like:
[ 1905.106209] YT8531S Gigabit Ethernet xxxxmac_mii_bus-XXXX:00:01:
PM: dpm_run_callback(): mdio_bus_phy_resume+0x0/0x180 [libphy] returns -95
[ 1905.106232] YT8531S Gigabit Ethernet xxxxmac_mii_bus-XXXX:00:01:
PM: failed to resume: error -95
In practice, only one PHY on the bus (e.g. XXXX:00:00) is typically
attached to a MAC interface; others (like XXXX:00:01) are probed but
not used, making such resume attempts unnecessary and misleading.
Add an early return in mdio_bus_phy_resume() when !phydev->attached_dev,
to prevent unneeded hardware initialization and avoids false error reports.
Fixes: 611d779af7ca ("net: phy: fix MDIO bus PM PHY resuming")
Signed-off-by: Yi Cong <yicong@...inos.cn>
---
drivers/net/phy/phy_device.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 7556aa3dd7ee..e8b4be967832 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -373,6 +373,9 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
struct phy_device *phydev = to_phy_device(dev);
int ret;
+ if (!phydev->attached_dev)
+ return 0;
+
if (phydev->mac_managed_pm)
return 0;
--
2.25.1
Powered by blists - more mailing lists