]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
drm/amd/display: Fix bug in debugfs crc_win_update entry
authorWayne Lin <Wayne.Lin@amd.com>
Fri, 26 Nov 2021 07:19:57 +0000 (15:19 +0800)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 28 Jan 2022 09:59:27 +0000 (10:59 +0100)
BugLink: https://bugs.launchpad.net/bugs/1959376
[ Upstream commit 4bef85d4c9491415b7931407b07f24841c1e0390 ]

[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: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 9a65df193108 ("drm/amd/display: Use PSP TA to read out crc")
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: Pavle Kotarac <Pavle.Kotarac@amd.com>
Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c

index de9ec5ddb6c72d3936f6f6a222524acbe920dd96..e94ddd5e7b638d05d04193fe75b2150dc341b664 100644 (file)
@@ -2908,10 +2908,13 @@ static int crc_win_update_set(void *data, u64 val)
        struct amdgpu_device *adev = drm_to_adev(new_crtc->dev);
        struct crc_rd_work *crc_rd_wrk = adev->dm.crc_rd_wrk;
 
+       if (!crc_rd_wrk)
+               return 0;
+
        if (val) {
                spin_lock_irq(&adev_to_drm(adev)->event_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_acrtc = to_amdgpu_crtc(old_crtc);
                }