linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: venus: venc: Fix runtime PM imbalance in venc_open
@ 2020-05-24  4:31 Dinghao Liu
  2020-06-23  9:47 ` Stanimir Varbanov
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2020-05-24  4:31 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Stanimir Varbanov, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel

pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/media/platform/qcom/venus/venc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index 9981a2a27c90..eefcfbb8f211 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -1169,7 +1169,7 @@ static int venc_open(struct file *file)
 
 	ret = pm_runtime_get_sync(core->dev_enc);
 	if (ret < 0)
-		goto err_free_inst;
+		goto err_put_sync;
 
 	ret = venc_ctrl_init(inst);
 	if (ret)
@@ -1214,7 +1214,6 @@ static int venc_open(struct file *file)
 	venc_ctrl_deinit(inst);
 err_put_sync:
 	pm_runtime_put_sync(core->dev_enc);
-err_free_inst:
 	kfree(inst);
 	return ret;
 }
-- 
2.17.1


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

* Re: [PATCH] media: venus: venc: Fix runtime PM imbalance in venc_open
  2020-05-24  4:31 [PATCH] media: venus: venc: Fix runtime PM imbalance in venc_open Dinghao Liu
@ 2020-06-23  9:47 ` Stanimir Varbanov
  0 siblings, 0 replies; 2+ messages in thread
From: Stanimir Varbanov @ 2020-06-23  9:47 UTC (permalink / raw)
  To: Dinghao Liu, kjlu
  Cc: Stanimir Varbanov, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel

Hi Dinghao,

Thanks for the patch!

On 5/24/20 7:31 AM, Dinghao Liu wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even
> when it returns an error code. Thus a pairing decrement is needed on
> the error handling path to keep the counter balanced.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/media/platform/qcom/venus/venc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

> 
> diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
> index 9981a2a27c90..eefcfbb8f211 100644
> --- a/drivers/media/platform/qcom/venus/venc.c
> +++ b/drivers/media/platform/qcom/venus/venc.c
> @@ -1169,7 +1169,7 @@ static int venc_open(struct file *file)
>  
>  	ret = pm_runtime_get_sync(core->dev_enc);
>  	if (ret < 0)
> -		goto err_free_inst;
> +		goto err_put_sync;
>  
>  	ret = venc_ctrl_init(inst);
>  	if (ret)
> @@ -1214,7 +1214,6 @@ static int venc_open(struct file *file)
>  	venc_ctrl_deinit(inst);
>  err_put_sync:
>  	pm_runtime_put_sync(core->dev_enc);
> -err_free_inst:
>  	kfree(inst);
>  	return ret;
>  }
> 

-- 
regards,
Stan

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

end of thread, other threads:[~2020-06-23  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-24  4:31 [PATCH] media: venus: venc: Fix runtime PM imbalance in venc_open Dinghao Liu
2020-06-23  9:47 ` Stanimir Varbanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).