[PATCH next] platform/x86/amd/pmc: fix leak in probe()

Dan Carpenter posted 1 patch 9 months, 1 week ago
drivers/platform/x86/amd/pmc/pmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH next] platform/x86/amd/pmc: fix leak in probe()
Posted by Dan Carpenter 9 months, 1 week ago
Call pci_dev_put(rdev) before returning.

Fixes: 6ad1b2dc0f2a ("platform/x86/amd/pmc: Use managed APIs for mutex")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/platform/x86/amd/pmc/pmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index 84bc47009e5f..d789d6cab794 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -785,7 +785,7 @@ static int amd_pmc_probe(struct platform_device *pdev)
 
 	err = devm_mutex_init(dev->dev, &dev->lock);
 	if (err)
-		return err;
+		goto err_pci_dev_put;
 
 	/* Get num of IP blocks within the SoC */
 	amd_pmc_get_ip_info(dev);
-- 
2.47.2
Re: [PATCH next] platform/x86/amd/pmc: fix leak in probe()
Posted by Ilpo Järvinen 9 months, 1 week ago
On Wed, 12 Mar 2025 11:31:57 +0300, Dan Carpenter wrote:

> Call pci_dev_put(rdev) before returning.
> 
> 


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86/amd/pmc: fix leak in probe()
      commit: 01db3d1ff43aeedeaf11c8bc9d09493ec00c8f4a

--
 i.