🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Arun Iyengar via B4 Relay Sat, 28 Nov 2026 17:37
[PATCH net-next v5 3/6] net: stmmac: Balance runtime PM when the probe fails
#23953
Author: Arun Iyengar via B4 Relay
Date: Sat, 28 Nov 2026 17:37
52 lines
12108 bytes
From: Arun Iyengar <aiyengar1990@gmail.com>

__stmmac_dvr_probe() takes a usage count and, unless the bus already
did, enables runtime PM before it registers the MDIO bus, but its error
path undoes neither. After a failed or deferred probe the device never
runtime-suspends.

Drop the usage count, and disable runtime PM if the probe enabled it.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ca4c7fb11b73..1280496741e7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -8091,6 +8091,7 @@ static int __stmmac_dvr_probe(struct device *device,
 			      struct stmmac_resources *res)
 {
 	struct net_device *ndev = NULL;
+	bool rpm_enabled = false;
 	struct stmmac_priv *priv;
 	int i, ret = 0;
 	u8 rxq;
@@ -8343,8 +8344,10 @@ static int __stmmac_dvr_probe(struct device *device,
 
 	pm_runtime_get_noresume(device);
 	pm_runtime_set_active(device);
-	if (!pm_runtime_enabled(device))
+	if (!pm_runtime_enabled(device)) {
 		pm_runtime_enable(device);
+		rpm_enabled = true;
+	}
 
 	ret = stmmac_mdio_register(ndev);
 	if (ret < 0) {
@@ -8398,6 +8401,9 @@ static int __stmmac_dvr_probe(struct device *device,
 error_pcs_setup:
 	stmmac_mdio_unregister(ndev);
 error_mdio_register:
+	if (rpm_enabled)
+		pm_runtime_disable(device);
+	pm_runtime_put_noidle(device);
 	stmmac_napi_del(ndev);
 error_hw_init:
 	destroy_workqueue(priv->wq);

-- 
2.55.0
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads