Skip to content

Commit 007d5f0

Browse files
committed
platform/x86:intel/pmc: Use devm for mutex_init
JIRA: https://issues.redhat.com/browse/RHEL-110838 commit 6f130e0 Author: Xi Pardee <xi.pardee@linux.intel.com> Date: Fri Apr 25 12:52:31 2025 -0700 platform/x86:intel/pmc: Use devm for mutex_init Use devm_mutex_init() to avoid accidental resource leak in the future. Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com> Link: https://lore.kernel.org/r/20250425195237.493129-4-xi.pardee@linux.intel.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Steve Best <sbest@redhat.com>
1 parent 5e1b057 commit 007d5f0

File tree

1 file changed

+3
-2
lines changed
  • drivers/platform/x86/intel/pmc

1 file changed

+3
-2
lines changed

drivers/platform/x86/intel/pmc/core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,6 @@ static void pmc_core_clean_structure(struct platform_device *pdev)
16811681
pmt_telem_unregister_endpoint(pmcdev->punit_ep);
16821682

16831683
platform_set_drvdata(pdev, NULL);
1684-
mutex_destroy(&pmcdev->lock);
16851684
}
16861685

16871686
static int pmc_core_probe(struct platform_device *pdev)
@@ -1726,7 +1725,9 @@ static int pmc_core_probe(struct platform_device *pdev)
17261725
if (!pmcdev->pkgc_res_cnt)
17271726
return -ENOMEM;
17281727

1729-
mutex_init(&pmcdev->lock);
1728+
ret = devm_mutex_init(&pdev->dev, &pmcdev->lock);
1729+
if (ret)
1730+
return ret;
17301731

17311732
if (pmc_dev_info->init)
17321733
ret = pmc_dev_info->init(pmcdev, pmc_dev_info);

0 commit comments

Comments
 (0)