From 445d3bed75de4082c7c7794030ac9a5b8bfde886 Mon Sep 17 00:00:00 2001 From: Inki Dae Date: Tue, 25 May 2021 19:51:39 +0900 Subject: drm/exynos: use pm_runtime_resume_and_get() Use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() to deal with usage counter. pm_runtime_get_sync() increases the usage counter even when it failed, which makes callers to forget to decrease the usage counter and resulted in reference leak. pm_runtime_resume_and_get() function decreases the usage counter when it failed internally so it can avoid the reference leak. Changelog v1: - Fix an build error reported by kernel test robot of Intel. Signed-off-by: Inki Dae Reported-by: kernel test robot --- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/drm/exynos/exynos_drm_g2d.c') diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 1e0c5a7f206e..cab4d2c370a7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -892,7 +892,14 @@ static void g2d_runqueue_worker(struct work_struct *work) g2d->runqueue_node = g2d_get_runqueue_node(g2d); if (g2d->runqueue_node) { - pm_runtime_get_sync(g2d->dev); + int ret; + + ret = pm_runtime_resume_and_get(g2d->dev); + if (ret < 0) { + dev_err(g2d->dev, "failed to enable G2D device.\n"); + return; + } + g2d_dma_start(g2d, g2d->runqueue_node); } } -- cgit v1.2.3