]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm: fix runtime PM imbalance issue in amdgpu_pm.c
authorYang Wang <kevinyang.wang@amd.com>
Thu, 16 Apr 2026 10:17:30 +0000 (18:17 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Apr 2026 18:51:15 +0000 (14:51 -0400)
Fix runtime PM counter imbalance to prevent device from failing to enter low power state

Fixes: a50d32c41fb2 ("drm/amd/pm: Deprecate print_clock_levels interface")
Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/amdgpu_pm.c

index 62b0b1ef0d103ec98b053fed2602f262cc039657..736304e73ca4d17aa6c51930a734af338409f7f6 100644 (file)
@@ -995,12 +995,15 @@ static ssize_t amdgpu_get_pp_dpm_clock(struct device *dev,
                return ret;
 
        ret = amdgpu_dpm_emit_clock_levels(adev, type, buf, &size);
-       if (ret)
-               return ret;
+       if (ret) {
+               size = ret;
+               goto out_pm_put;
+       }
 
        if (size == 0)
                size = sysfs_emit(buf, "\n");
 
+out_pm_put:
        amdgpu_pm_put_access(adev);
 
        return size;
@@ -3902,11 +3905,14 @@ static int amdgpu_retrieve_od_settings(struct amdgpu_device *adev,
                return ret;
 
        ret = amdgpu_dpm_emit_clock_levels(adev, od_type, buf, &size);
-       if (ret)
-               return ret;
+       if (ret) {
+               size = ret;
+               goto out_pm_put;
+       }
        if (size == 0)
                size = sysfs_emit(buf, "\n");
 
+out_pm_put:
        amdgpu_pm_put_access(adev);
 
        return size;