public inbox for dri-devel@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/modes: Prevent division by zero htotal
@ 2019-01-23  7:28 Tina Zhang
  2019-01-23 10:56 ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Tina Zhang @ 2019-01-23  7:28 UTC (permalink / raw)
  Cc: intel-gfx, dri-devel, Adam Jackson, Dave Airlie

This patch prevents division by zero htotal.

Signed-off-by: Tina Zhang <tina.zhang@intel.com>
Cc: Adam Jackson <ajax@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Daniel Vetter <daniel@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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-24  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-23  7:28 [PATCH] drm/modes: Prevent division by zero htotal Tina Zhang
2019-01-23 10:56 ` Daniel Vetter
2019-01-24  7:11   ` Zhang, Tina
2019-01-24  9:59     ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox