diff mbox series

drm/etnaviv: Add missing pm_runtime_put

Message ID 1642515391-19329-1-git-send-email-lyz_cs@pku.edu.cn (mailing list archive)
State New, archived
Headers show
Series drm/etnaviv: Add missing pm_runtime_put | expand

Commit Message

刘永志 Jan. 18, 2022, 2:16 p.m. UTC
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.

Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Lucas Stach Jan. 19, 2022, 10:51 a.m. UTC | #1
Am Dienstag, dem 18.01.2022 um 06:16 -0800 schrieb Yongzhi Liu:
> 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.
> 
Instead of adding more error handling code here, I would prefer to
convert this to pm_runtime_resume_and_get to avoid this issue.

Regards,
Lucas

> Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index 242a5fd..5e81a98 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -1714,6 +1714,9 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
>  	return 0;
>  
>  out_sched:
> +#ifdef CONFIG_PM
> +	pm_runtime_put_autosuspend(gpu->dev);
> +#endif
>  	etnaviv_sched_fini(gpu);
>  
>  out_workqueue:
刘永志 Jan. 19, 2022, 11:36 a.m. UTC | #2
> -----原始邮件-----
> 发件人: "Lucas Stach" <l.stach@pengutronix.de>
> 发送时间: 2022-01-19 18:51:20 (星期三)
> 收件人: "Yongzhi Liu" <lyz_cs@pku.edu.cn>, linux+etnaviv@armlinux.org.uk, christian.gmeiner@gmail.com, airlied@linux.ie, daniel@ffwll.ch, etnaviv@lists.freedesktop.org
> 抄送: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
> 主题: Re: [PATCH] drm/etnaviv: Add missing pm_runtime_put
> 
> Am Dienstag, dem 18.01.2022 um 06:16 -0800 schrieb Yongzhi Liu:
> > 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.
> > 
> Instead of adding more error handling code here, I would prefer to
> convert this to pm_runtime_resume_and_get to avoid this issue.
> 
> Regards,
> Lucas
> 

I will resend my modified patch. Thanks for your reply.

> > Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>
> > ---
> >  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> > index 242a5fd..5e81a98 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> > @@ -1714,6 +1714,9 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
> >  	return 0;
> >  
> >  out_sched:
> > +#ifdef CONFIG_PM
> > +	pm_runtime_put_autosuspend(gpu->dev);
> > +#endif
> >  	etnaviv_sched_fini(gpu);
> >  
> >  out_workqueue:
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 242a5fd..5e81a98 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1714,6 +1714,9 @@  static int etnaviv_gpu_bind(struct device *dev, struct device *master,
 	return 0;
 
 out_sched:
+#ifdef CONFIG_PM
+	pm_runtime_put_autosuspend(gpu->dev);
+#endif
 	etnaviv_sched_fini(gpu);
 
 out_workqueue: