public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: ti: edma: Fix reference count leaks due to pm_runtime_get_sync
@ 2020-11-23 13:59 Wang Xiaojun
  2020-11-24 17:24 ` Vinod Koul
  0 siblings, 1 reply; 4+ messages in thread
From: Wang Xiaojun @ 2020-11-23 13:59 UTC (permalink / raw)
  To: vkoul, dan.j.williams; +Cc: dmaengine

On calling pm_runtime_get_sync() the reference count of the device
is incremented. In case of failure, should decrement the reference
count before returning the error. So we fixed it by replacing it
with pm_runtime_resume_and_get.

Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
---
 drivers/dma/ti/edma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
index 35d81bd857f1..38af8b596e1c 100644
--- a/drivers/dma/ti/edma.c
+++ b/drivers/dma/ti/edma.c
@@ -2399,7 +2399,7 @@ 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");
 		pm_runtime_disable(dev);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dmaengine: ti: edma: Fix reference count leaks due to pm_runtime_get_sync
  2020-11-23 13:59 [PATCH] dmaengine: ti: edma: Fix reference count leaks due to pm_runtime_get_sync Wang Xiaojun
@ 2020-11-24 17:24 ` Vinod Koul
  2020-11-25  6:36   ` Peter Ujfalusi
  0 siblings, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2020-11-24 17:24 UTC (permalink / raw)
  To: Wang Xiaojun, Peter Ujfalusi; +Cc: dan.j.williams, dmaengine

On 23-11-20, 21:59, Wang Xiaojun wrote:
> On calling pm_runtime_get_sync() the reference count of the device
> is incremented. In case of failure, should decrement the reference
> count before returning the error. So we fixed it by replacing it
> with pm_runtime_resume_and_get.

Peter?

> 
> Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
> ---
>  drivers/dma/ti/edma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
> index 35d81bd857f1..38af8b596e1c 100644
> --- a/drivers/dma/ti/edma.c
> +++ b/drivers/dma/ti/edma.c
> @@ -2399,7 +2399,7 @@ 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");
>  		pm_runtime_disable(dev);
> -- 
> 2.25.1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dmaengine: ti: edma: Fix reference count leaks due to pm_runtime_get_sync
  2020-11-24 17:24 ` Vinod Koul
@ 2020-11-25  6:36   ` Peter Ujfalusi
  2020-12-11 13:35     ` Vinod Koul
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Ujfalusi @ 2020-11-25  6:36 UTC (permalink / raw)
  To: Vinod Koul, Wang Xiaojun; +Cc: dan.j.williams, dmaengine



On 24/11/2020 19.24, Vinod Koul wrote:
> On 23-11-20, 21:59, Wang Xiaojun wrote:
>> On calling pm_runtime_get_sync() the reference count of the device
>> is incremented. In case of failure, should decrement the reference
>> count before returning the error. So we fixed it by replacing it
>> with pm_runtime_resume_and_get.
> 
> Peter?

Looks good.

fwiw, the pm_runtime_resume_and_get() landed in mainline with v5.10-rc5,
so it is fresh, but what it does is legit.

Wang: thank you for the patch.

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> 
>>
>> Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
>> ---
>>  drivers/dma/ti/edma.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
>> index 35d81bd857f1..38af8b596e1c 100644
>> --- a/drivers/dma/ti/edma.c
>> +++ b/drivers/dma/ti/edma.c
>> @@ -2399,7 +2399,7 @@ 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");
>>  		pm_runtime_disable(dev);
>> -- 
>> 2.25.1
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dmaengine: ti: edma: Fix reference count leaks due to pm_runtime_get_sync
  2020-11-25  6:36   ` Peter Ujfalusi
@ 2020-12-11 13:35     ` Vinod Koul
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2020-12-11 13:35 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: Wang Xiaojun, dan.j.williams, dmaengine

On 25-11-20, 08:36, Peter Ujfalusi wrote:
> 
> 
> On 24/11/2020 19.24, Vinod Koul wrote:
> > On 23-11-20, 21:59, Wang Xiaojun wrote:
> >> On calling pm_runtime_get_sync() the reference count of the device
> >> is incremented. In case of failure, should decrement the reference
> >> count before returning the error. So we fixed it by replacing it
> >> with pm_runtime_resume_and_get.
> > 
> > Peter?
> 
> Looks good.
> 
> fwiw, the pm_runtime_resume_and_get() landed in mainline with v5.10-rc5,
> so it is fresh, but what it does is legit.

So I cant apply this patch, please rebase and resend after -rc1, with
Peter's ack

> 
> Wang: thank you for the patch.
> 
> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> 
> > 
> >>
> >> Signed-off-by: Wang Xiaojun <wangxiaojun11@huawei.com>
> >> ---
> >>  drivers/dma/ti/edma.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c
> >> index 35d81bd857f1..38af8b596e1c 100644
> >> --- a/drivers/dma/ti/edma.c
> >> +++ b/drivers/dma/ti/edma.c
> >> @@ -2399,7 +2399,7 @@ 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");
> >>  		pm_runtime_disable(dev);
> >> -- 
> >> 2.25.1
> > 
> 
> - Péter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-11 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-23 13:59 [PATCH] dmaengine: ti: edma: Fix reference count leaks due to pm_runtime_get_sync Wang Xiaojun
2020-11-24 17:24 ` Vinod Koul
2020-11-25  6:36   ` Peter Ujfalusi
2020-12-11 13:35     ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox