[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1616840922-8512-1-git-send-email-huangguobin4@huawei.com>
Date: Sat, 27 Mar 2021 18:28:42 +0800
From: Huang Guobin <huangguobin4@...wei.com>
To: <huangguobin4@...wei.com>, Wingman Kwok <w-kwok2@...com>,
Murali Karicheri <m-karicheri2@...com>,
"David S. Miller" <davem@...emloft.net>,
"Jakub Kicinski" <kuba@...nel.org>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH net-next v2] net: netcp: fix PM reference leak in netcp_probe()
From: Guobin Huang <huangguobin4@...wei.com>
pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Guobin Huang <huangguobin4@...wei.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 d7a144b4a09f..0675f259033e 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -2171,7 +2171,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);
Powered by blists - more mailing lists