From: Aurabindo Pillai <[email protected]>

When userspace asks us to enable vblank on a crtc that is not yet
enabled return -EINVAL. There is no need to queue the vblank handler in
this case, so return early.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/1856

Reviewed-by: Sun peng Li <[email protected]>
Signed-off-by: Aurabindo Pillai <[email protected]>
Signed-off-by: Zaeem Mohamed <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
index e8bdd7f0c460..22d9ded489af 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
@@ -302,8 +302,8 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc 
*crtc, bool enable)
        int irq_type;
        int rc = 0;
 
-       if (acrtc->otg_inst == -1)
-               goto skip;
+       if (!acrtc->base.enabled)
+               return -EINVAL;
 
        irq_type = amdgpu_display_crtc_idx_to_irq_type(adev, acrtc->crtc_id);
 
@@ -365,7 +365,6 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc 
*crtc, bool enable)
                        return rc;
        }
 #endif
-skip:
        if (amdgpu_in_reset(adev))
                return 0;
 
@@ -752,4 +751,3 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
        kfree(cursor_plane);
        return res;
 }
-
-- 
2.34.1

Reply via email to