On Wed, Jan 23, 2019 at 03:28:59PM +0800, Tina Zhang wrote:
> This patch prevents division by zero htotal.

How did you manage to get here with htotal == 0? This needs backtraces
(or if this is just about static checkers, a mention of that).
-Daniel

> 
> Signed-off-by: Tina Zhang <tina.zh...@intel.com>
> Cc: Adam Jackson <a...@redhat.com>
> Cc: Dave Airlie <airl...@redhat.com>
> Cc: Daniel Vetter <dan...@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_modes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index adce9a2..59b92b1 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -751,7 +751,7 @@ int drm_mode_hsync(const struct drm_display_mode *mode)
>       if (mode->hsync)
>               return mode->hsync;
>  
> -     if (mode->htotal < 0)
> +     if (mode->htotal <= 0)
>               return 0;
>  
>       calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to