pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.

Reported-by: Hulk Robot <hul...@huawei.com>
Signed-off-by: Yu Kuai <yuku...@huawei.com>
---
 drivers/gpu/drm/v3d/v3d_debugfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/v3d/v3d_debugfs.c 
b/drivers/gpu/drm/v3d/v3d_debugfs.c
index e76b24bb8828..91ceed774140 100644
--- a/drivers/gpu/drm/v3d/v3d_debugfs.c
+++ b/drivers/gpu/drm/v3d/v3d_debugfs.c
@@ -132,7 +132,7 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void 
*unused)
        u32 ident0, ident1, ident2, ident3, cores;
        int ret, core;
 
-       ret = pm_runtime_get_sync(v3d->drm.dev);
+       ret = pm_runtime_resume_and_get(v3d->drm.dev);
        if (ret < 0)
                return ret;
 
@@ -219,7 +219,7 @@ static int v3d_measure_clock(struct seq_file *m, void 
*unused)
        int measure_ms = 1000;
        int ret;
 
-       ret = pm_runtime_get_sync(v3d->drm.dev);
+       ret = pm_runtime_resume_and_get(v3d->drm.dev);
        if (ret < 0)
                return ret;
 
-- 
2.25.4

Reply via email to