mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] net: ethernet: ti: netcp: fix pm_runtime usage counter leak on error
@ 2026-09-18  4:28 phucduc.bui
  2026-09-22  7:16 ` Simon Horman
  2026-09-22 11:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: phucduc.bui @ 2026-09-18  4:28 UTC (permalink / raw)
  To: Andrew Lunn, davem, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Jacob Keller, David Yang, Vadim Fedorenko, Nishanth Menon,
	Wingman Kwok, m-karicheri2, linux-kernel, netdev, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/net/ethernet/ti/netcp_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index eb8fc2ed05f4..4f9e20468bbb 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -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);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: ethernet: ti: netcp: fix pm_runtime usage counter leak on error
  2026-09-18  4:28 [PATCH net] net: ethernet: ti: netcp: fix pm_runtime usage counter leak on error phucduc.bui
@ 2026-09-22  7:16 ` Simon Horman
  2026-09-22 11:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2026-09-22  7:16 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Andrew Lunn, davem, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Jacob Keller, David Yang, Vadim Fedorenko, Nishanth Menon,
	Wingman Kwok, m-karicheri2, linux-kernel, netdev

On Fri, Sep 18, 2026 at 11:28:04AM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> 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")
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: ethernet: ti: netcp: fix pm_runtime usage counter leak on error
  2026-09-18  4:28 [PATCH net] net: ethernet: ti: netcp: fix pm_runtime usage counter leak on error phucduc.bui
  2026-09-22  7:16 ` Simon Horman
@ 2026-09-22 11:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-22 11:20 UTC (permalink / raw)
  To: Bui Duc Phuc
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, jacob.e.keller,
	mmyangfl, vadim.fedorenko, nm, w-kwok2, m-karicheri2,
	linux-kernel, netdev

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Fri, 18 Sep 2026 11:28:04 +0700 you wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> 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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-22 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18  4:28 [PATCH net] net: ethernet: ti: netcp: fix pm_runtime usage counter leak on error phucduc.bui
2026-09-22  7:16 ` Simon Horman
2026-09-22 11:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®