Commit 4bef85d4 authored by Wayne Lin's avatar Wayne Lin Committed by Alex Deucher

drm/amd/display: Fix bug in debugfs crc_win_update entry

[Why]
crc_rd_wrk shouldn't be null in crc_win_update_set(). Current programming
logic is inconsistent in crc_win_update_set().

[How]
Initially, return if crc_rd_wrk is NULL. Later on, we can use member of
crc_rd_wrk safely.
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Fixes: 9a65df19 ("drm/amd/display: Use PSP TA to read out crc")
Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: default avatarPavle Kotarac <Pavle.Kotarac@amd.com>
Signed-off-by: default avatarWayne Lin <Wayne.Lin@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a1f5e392
...@@ -2953,10 +2953,13 @@ static int crc_win_update_set(void *data, u64 val) ...@@ -2953,10 +2953,13 @@ static int crc_win_update_set(void *data, u64 val)
struct amdgpu_device *adev = drm_to_adev(new_crtc->dev); struct amdgpu_device *adev = drm_to_adev(new_crtc->dev);
struct crc_rd_work *crc_rd_wrk = adev->dm.crc_rd_wrk; struct crc_rd_work *crc_rd_wrk = adev->dm.crc_rd_wrk;
if (!crc_rd_wrk)
return 0;
if (val) { if (val) {
spin_lock_irq(&adev_to_drm(adev)->event_lock); spin_lock_irq(&adev_to_drm(adev)->event_lock);
spin_lock_irq(&crc_rd_wrk->crc_rd_work_lock); spin_lock_irq(&crc_rd_wrk->crc_rd_work_lock);
if (crc_rd_wrk && crc_rd_wrk->crtc) { if (crc_rd_wrk->crtc) {
old_crtc = crc_rd_wrk->crtc; old_crtc = crc_rd_wrk->crtc;
old_acrtc = to_amdgpu_crtc(old_crtc); old_acrtc = to_amdgpu_crtc(old_crtc);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment