Re: [PATCH 4/4] platform/x86/amd/pmc: Use managed APIs for mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 Feb 2025, Shyam Sundar S K wrote:

> Adopt managed devm_* APIs for handling mutex creation and deletion,
> facilitating automatic resource cleanup.
> 
> Co-developed-by: Sanket Goswami <Sanket.Goswami@xxxxxxx>
> Signed-off-by: Sanket Goswami <Sanket.Goswami@xxxxxxx>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@xxxxxxx>
> ---
>  drivers/platform/x86/amd/pmc/pmc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
> index d80a5b899a1d..f4768bd6b424 100644
> --- a/drivers/platform/x86/amd/pmc/pmc.c
> +++ b/drivers/platform/x86/amd/pmc/pmc.c
> @@ -778,7 +778,7 @@ static int amd_pmc_probe(struct platform_device *pdev)
>  		goto err_pci_dev_put;
>  	}
>  
> -	mutex_init(&dev->lock);
> +	devm_mutex_init(dev->dev, &dev->lock);

Please add error handling.

>  
>  	/* Get num of IP blocks within the SoC */
>  	amd_pmc_get_ip_info(dev);
> @@ -817,7 +817,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[] = {
> 

-- 
 i.





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux