drm/tegra: Handle 64-bit return from drm_crtc_vblank_count()
authorDhinakaran Pandiyan <[email protected]>
Sat, 3 Feb 2018 05:12:58 +0000 (21:12 -0800)
committerRodrigo Vivi <[email protected]>
Thu, 15 Feb 2018 19:49:49 +0000 (11:49 -0800)
570e86963a51 ("drm: Widen vblank count to 64-bits [v3]") changed the
return type for drm_crtc_vblank_count() to u64. This could cause
potential problems if the return value is used in arithmetic operations
with a 32-bit reference HW vblank count. Explicitly typecasting this
down to u32 either fixes a potential problem or serves to add clarity in
case the implicit typecasting was already correct.

Cc: Keith Packard <[email protected]>
Cc: Thierry Reding <[email protected]>
Signed-off-by: Dhinakaran Pandiyan <[email protected]>
Reviewed-by: Keith Packard <[email protected]>
Acked-by: Thierry Reding <[email protected]>
Signed-off-by: Rodrigo Vivi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/tegra/dc.c

index b8403ed48285288c277d224e253285caebed3adb..49df2db2ad4648fccdc4f3d8d4609fdae3aa5ebe 100644 (file)
@@ -1359,7 +1359,7 @@ static u32 tegra_dc_get_vblank_counter(struct drm_crtc *crtc)
                return host1x_syncpt_read(dc->syncpt);
 
        /* fallback to software emulated VBLANK counter */
-       return drm_crtc_vblank_count(&dc->base);
+       return (u32)drm_crtc_vblank_count(&dc->base);
 }
 
 static int tegra_dc_enable_vblank(struct drm_crtc *crtc)