[PATCH 1/2] drm/amdgpu: correct the amdgpu runtime dereference usage count

Prike Liang Prike.Liang at amd.com
Thu Nov 9 07:37:00 UTC 2023


Fix the amdgpu runpm dereference usage count.

Signed-off-by: Prike Liang <Prike.Liang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index a53f436fa9f1..f6bbbbe5d9f7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1992,7 +1992,7 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val)
 
 	ret = amdgpu_dpm_set_soft_freq_range(adev, PP_SCLK, (uint32_t)val, (uint32_t)val);
 	if (ret)
-		ret = -EINVAL;
+		goto out;
 
 out:
 	pm_runtime_mark_last_busy(adev_to_drm(adev)->dev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 0cacd0b9f8be..ff1f42ae6d8e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -346,6 +346,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
 	if (!active && adev->have_disp_power_ref) {
 		pm_runtime_put_autosuspend(dev->dev);
 		adev->have_disp_power_ref = false;
+		return ret;
 	}
 
 out:
-- 
2.34.1



More information about the amd-gfx mailing list