Skip to content

Commit 6ad1b2d

Browse files
Shyam Sundar S Kij-intel
authored andcommitted
platform/x86/amd/pmc: Use managed APIs for mutex
Adopt managed devm_* APIs for handling mutex creation and deletion, facilitating automatic resource cleanup. Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Link: https://lore.kernel.org/r/20250305142615.410178-4-Shyam-sundar.S-k@amd.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent c183cf6 commit 6ad1b2d

File tree

1 file changed

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

1 file changed

+3
-2
lines changed

drivers/platform/x86/amd/pmc/pmc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,9 @@ static int amd_pmc_probe(struct platform_device *pdev)
783783
goto err_pci_dev_put;
784784
}
785785

786-
mutex_init(&dev->lock);
786+
err = devm_mutex_init(dev->dev, &dev->lock);
787+
if (err)
788+
return err;
787789

788790
/* Get num of IP blocks within the SoC */
789791
amd_pmc_get_ip_info(dev);
@@ -822,7 +824,6 @@ static void amd_pmc_remove(struct platform_device *pdev)
822824
pci_dev_put(dev->rdev);
823825
if (IS_ENABLED(CONFIG_AMD_MP2_STB))
824826
amd_mp2_stb_deinit(dev);
825-
mutex_destroy(&dev->lock);
826827
}
827828

828829
static const struct acpi_device_id amd_pmc_acpi_ids[] = {

0 commit comments

Comments
 (0)