Skip to contentSkip to conversation

net: ethernet: ti: netcp: fix pm_runtime usage counter leak on error

PATCH Applied [email protected] 3 participants 3 messages Sep 18 – Sep 22

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

PATCH 1/1 net: ethernet: ti: netcp: fix pm_runtime usage counter leak on error

From: bui duc phuc <[email protected]>

pm_runtime_get_sync() leaves the runtime PM usage counter incremented even when it fails, but the error path in netcp_probe() does not call pm_runtime_put_noidle() to balance it, leaking a reference each time resume fails.

Use pm_runtime_resume_and_get() instead, which automatically drops the usage counter on failure, fixing the leak.

Fixes 84640e27f230 ("net: netcp: Add Keystone NetCP core ethernet driver")
---
 drivers/net/ethernet/ti/netcp_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/netcp_core.c +1 -1
index eb8fc2ed05f4..4f9e20468bbb 100644
@@ -2225,7 +2225,7 @@ static int netcp_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	pm_runtime_enable(&pdev->dev);
-	ret = pm_runtime_get_sync(&pdev->dev);
+	ret = pm_runtime_resume_and_get(&pdev->dev);
 	if (ret < 0) {
 		dev_err(dev, "Failed to enable NETCP power-domain\n");
 		pm_runtime_disable(&pdev->dev);
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Fri, Sep 18, 2026 at 11:28:04AM +0700, [email protected] wrote:

From: bui duc phuc <[email protected]>

pm_runtime_get_sync() leaves the runtime PM usage counter incremented even when it fails, but the error path in netcp_probe() does not call pm_runtime_put_noidle() to balance it, leaking a reference each time resume fails.

Quoted 5 lines

Use pm_runtime_resume_and_get() instead, which automatically drops the usage counter on failure, fixing the leak.

Fixes 84640e27f230 ("net: netcp: Add Keystone NetCP core ethernet driver")
#2 lore raw
In reply to [email protected]
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

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

Quoted 8 lines · On Fri, 18 Sep 2026 11:28:04 +0700 you wrote:

From: bui duc phuc <[email protected]>

pm_runtime_get_sync() leaves the runtime PM usage counter incremented even when it fails, but the error path in netcp_probe() does not call pm_runtime_put_noidle() to balance it, leaking a reference each time resume fails.

[...]

Here is the summary with links:
- [net] net: ethernet: ti: netcp: fix pm_runtime usage counter leak on error

    https://git.kernel.org/netdev/net/c/ac4334522e4b

You are awesome, thank you!

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