* [PATCH] drm/etnaviv: fix runtime pm imbalance on error
@ 2020-05-20 10:05 Dinghao Liu
0 siblings, 0 replies; 2+ messages in thread
From: Dinghao Liu @ 2020-05-20 10:05 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: David Airlie, etnaviv, dri-devel, linux-kernel, Russell King
pm_runtime_get_sync() increments the runtime PM usage counter even
the call 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/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 a31eeff2b297..da3f6ca5849f 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1691,6 +1691,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:
--
2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] drm/etnaviv: Fix runtime PM imbalance on error
@ 2022-01-19 11:34 Yongzhi Liu
0 siblings, 0 replies; 2+ messages in thread
From: Yongzhi Liu @ 2022-01-19 11:34 UTC (permalink / raw)
To: l.stach, linux+etnaviv, christian.gmeiner, airlied, daniel
Cc: Yongzhi Liu, etnaviv, dri-devel, linux-kernel
pm_runtime_get_sync() will increase the rumtime PM counter
even it returns an error. Thus a pairing decrement is needed
to prevent refcount leak. Fix this by replacing this API with
pm_runtime_resume_and_get(), which will not change the runtime
PM counter on error.
Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>
---
drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 242a5fd..aa64f45 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1690,7 +1690,7 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
goto out_workqueue;
#ifdef CONFIG_PM
- ret = pm_runtime_get_sync(gpu->dev);
+ ret = pm_runtime_resume_and_get(gpu->dev);
#else
ret = etnaviv_gpu_clk_enable(gpu);
#endif
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-19 11:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 10:05 [PATCH] drm/etnaviv: fix runtime pm imbalance on error Dinghao Liu
2022-01-19 11:34 [PATCH] drm/etnaviv: Fix runtime PM " Yongzhi Liu
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).