drm/amd/display: Fix bug in debugfs crc_win_update entry
authorjsg <jsg@openbsd.org>
Thu, 27 Jan 2022 22:46:54 +0000 (22:46 +0000)
committerjsg <jsg@openbsd.org>
Thu, 27 Jan 2022 22:46:54 +0000 (22:46 +0000)
From Wayne Lin
6dcc6706dab10744d277bdc2613fb135c6a632dd in linux 5.15.y/5.15.17
4bef85d4c9491415b7931407b07f24841c1e0390 in mainline linux

sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c

index de9ec5d..e94ddd5 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);
                }