diff options
author | Shyam Sundar S K <Shyam-sundar.S-k@amd.com> | 2025-03-05 17:26:15 +0300 |
---|---|---|
committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2025-03-07 13:17:51 +0300 |
commit | 6ad1b2dc0f2a76b23a31fc7a52ed4ec06e4344a3 (patch) | |
tree | 3531cd3575c3970e1f60af6b9efd29c41304d27c | |
parent | c183cf6c5398f7b31b4fb67a5326f045c51d783a (diff) | |
download | linux-6ad1b2dc0f2a76b23a31fc7a52ed4ec06e4344a3.tar.xz |
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>
-rw-r--r-- | drivers/platform/x86/amd/pmc/pmc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c index 1ad3eb935404..84bc47009e5f 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -783,7 +783,9 @@ static int amd_pmc_probe(struct platform_device *pdev) goto err_pci_dev_put; } - mutex_init(&dev->lock); + err = devm_mutex_init(dev->dev, &dev->lock); + if (err) + return err; /* Get num of IP blocks within the SoC */ amd_pmc_get_ip_info(dev); @@ -822,7 +824,6 @@ static void amd_pmc_remove(struct platform_device *pdev) pci_dev_put(dev->rdev); if (IS_ENABLED(CONFIG_AMD_MP2_STB)) amd_mp2_stb_deinit(dev); - mutex_destroy(&dev->lock); } static const struct acpi_device_id amd_pmc_acpi_ids[] = { |