mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
platform/x86/amd/pmf: Use devm_mutex_init() for mutex initialization
Replace mutex_init() with the devm_mutex_init(), to ensure proper mutex cleanup during probe failure and driver removal. Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Link: https://patch.msgid.link/20251119085813.546813-2-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>
This commit is contained in:
parent
2bd038de12
commit
0b39ce8f71
|
|
@ -465,9 +465,17 @@ static int amd_pmf_probe(struct platform_device *pdev)
|
|||
if (!dev->regbase)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_init(&dev->lock);
|
||||
mutex_init(&dev->update_mutex);
|
||||
mutex_init(&dev->cb_mutex);
|
||||
err = devm_mutex_init(dev->dev, &dev->lock);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = devm_mutex_init(dev->dev, &dev->update_mutex);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = devm_mutex_init(dev->dev, &dev->cb_mutex);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
apmf_acpi_init(dev);
|
||||
platform_set_drvdata(pdev, dev);
|
||||
|
|
@ -491,9 +499,6 @@ static void amd_pmf_remove(struct platform_device *pdev)
|
|||
amd_pmf_notify_sbios_heartbeat_event_v2(dev, ON_UNLOAD);
|
||||
apmf_acpi_deinit(dev);
|
||||
amd_pmf_dbgfs_unregister(dev);
|
||||
mutex_destroy(&dev->lock);
|
||||
mutex_destroy(&dev->update_mutex);
|
||||
mutex_destroy(&dev->cb_mutex);
|
||||
}
|
||||
|
||||
static const struct attribute_group *amd_pmf_driver_groups[] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user