[PATCH net-next 3/4] net: stmmac: add missing serdes power down in error paths

Russell King (Oracle) rmk+kernel at armlinux.org.uk
Tue Feb 3 02:01:24 PST 2026


The open path is missing cleanup of a successful serdes power up if
stmmac_hw_setup() or stmmac_request_irq() fails.

stmmac_resume() is also missing cleanup of the serdes power up if
stmmac_hw_setup() fails.

Add the missing cleanups.

Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 9efdde915229..05b0b080bade 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4137,7 +4137,7 @@ static int __stmmac_open(struct net_device *dev,
 	if (!(priv->plat->flags & STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP)) {
 		ret = stmmac_legacy_serdes_power_up(priv);
 		if (ret < 0)
-			goto init_error;
+			return ret;
 	}
 
 	ret = stmmac_hw_setup(dev);
@@ -4170,6 +4170,7 @@ static int __stmmac_open(struct net_device *dev,
 
 	stmmac_release_ptp(priv);
 init_error:
+	stmmac_legacy_serdes_power_down(priv);
 	return ret;
 }
 
@@ -8273,6 +8274,7 @@ int stmmac_resume(struct device *dev)
 	ret = stmmac_hw_setup(ndev);
 	if (ret < 0) {
 		netdev_err(priv->dev, "%s: Hw setup failed\n", __func__);
+		stmmac_legacy_serdes_power_down(priv);
 		mutex_unlock(&priv->lock);
 		rtnl_unlock();
 		return ret;
-- 
2.47.3




More information about the linux-arm-kernel mailing list