Re: [PATCH] dmaengine: ti: Fix runtime PM imbalance on error

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

 




On 1/16/22 13:31, Yongzhi Liu wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even
> when it returns an error code, thus a matching decrement is needed on
> the error handling path to keep the counter balanced.

The patch is correct, however the commit message is a bit incorrect.

We are not adding any visible matching decrement, we are switching to
pm_runtime_resume_and_get() which only increments the usage counter if
pm_runtime_resume() is successful.
Granted internally it does a pm_runtime_put_noidle() if resume call fails.

Switch to pm_runtime_resume_and_get() to keep the device's use caunt
balanced?

> 
> Signed-off-by: Yongzhi Liu <lyz_cs@xxxxxxxxxx>
> ---
>  drivers/dma/ti/edma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
> index 08e47f4..a73f779 100644
> --- a/drivers/dma/ti/edma.c
> +++ b/drivers/dma/ti/edma.c
> @@ -2398,9 +2398,9 @@ static int edma_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, ecc);
>  
>  	pm_runtime_enable(dev);
> -	ret = pm_runtime_get_sync(dev);
> +	ret = pm_runtime_resume_and_get(dev);
>  	if (ret < 0) {
> -		dev_err(dev, "pm_runtime_get_sync() failed\n");
> +		dev_err(dev, "pm_runtime_resume_and_get() failed\n");
>  		pm_runtime_disable(dev);
>  		return ret;
>  	}

-- 
Péter



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux