drm/amdgpu: Add missing pm_runtime_put_autosuspend
authorYongzhi Liu <lyz_cs@pku.edu.cn>
Tue, 18 Jan 2022 20:11:51 +0000 (15:11 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 18 Jan 2022 22:43:36 +0000 (17:43 -0500)
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>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

index 9aea1cc..4b950de 100644 (file)
@@ -1120,8 +1120,10 @@ static ssize_t amdgpu_debugfs_gfxoff_read(struct file *f, char __user *buf,
                return -EINVAL;
 
        r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
-       if (r < 0)
+       if (r < 0) {
+               pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
                return r;
+       }
 
        while (size) {
                uint32_t value;