[PATCH] drm/modes: Prevent division by zero htotal
Tina Zhang
tina.zhang at intel.com
Wed Jan 23 07:28:59 UTC 2019
This patch prevents division by zero htotal.
Signed-off-by: Tina Zhang <tina.zhang at intel.com>
Cc: Adam Jackson <ajax at redhat.com>
Cc: Dave Airlie <airlied at redhat.com>
Cc: Daniel Vetter <daniel at 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
More information about the dri-devel
mailing list