The timer expiry must be later than the current vblank timestamp. By
testing with !ktime_compare(), the expiry time could also be before
the vblank timestamp. Use ktime_after() to verify that the timer expires
in the future.

Signed-off-by: Thomas Zimmermann <[email protected]>
---
 drivers/gpu/drm/drm_vblank.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index b5d2fb741b2d..75e2183be0ab 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -2329,7 +2329,7 @@ bool drm_crtc_vblank_get_vblank_timeout(struct drm_crtc 
*crtc, ktime_t *vblank_t
                        *vblank_time = READ_ONCE(vtimer->timer.node.expires);
                } while (cur_count != drm_crtc_vblank_count_and_time(crtc, 
&cur_time));
 
-               if (drm_WARN_ON(dev, !ktime_compare(*vblank_time, cur_time)))
+               if (drm_WARN_ON(dev, !ktime_after(*vblank_time, cur_time)))
                        return false; /* already expired */
 
                framedur_ns = vblank->framedur_ns;
-- 
2.54.0

Reply via email to