All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Avoid divide by zero
@ 2019-01-22 12:58 Mika Kahola
  2019-01-22 13:07 ` Jani Nikula
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Mika Kahola @ 2019-01-22 12:58 UTC (permalink / raw)
  To: intel-gfx

Avoid divide by zero warning on static analysis.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 8b63afa3a221..6a8e8b3f44c2 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3912,8 +3912,10 @@ skl_ddb_get_pipe_allocation_limits(struct drm_i915_private *dev_priv,
 			pipe_width = hdisplay;
 	}
 
-	alloc->start = ddb_size * width_before_pipe / total_width;
-	alloc->end = ddb_size * (width_before_pipe + pipe_width) / total_width;
+	alloc->start = total_width == 0 ?
+		0 : ddb_size * width_before_pipe / total_width;
+	alloc->end = total_width == 0 ?
+		0 : ddb_size * (width_before_pipe + pipe_width) / total_width;
 }
 
 static unsigned int skl_cursor_allocation(int num_active)
-- 
2.17.1

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

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

end of thread, other threads:[~2019-01-23 18:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-22 12:58 [PATCH] drm/i915: Avoid divide by zero Mika Kahola
2019-01-22 13:07 ` Jani Nikula
2019-01-22 13:22   ` Kahola, Mika
2019-01-22 16:00 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-01-22 16:23 ` [PATCH] " Ville Syrjälä
2019-01-22 18:09   ` Jani Nikula
2019-01-22 19:09     ` Ville Syrjälä
2019-01-23  7:21       ` Kahola, Mika
2019-01-23 18:32         ` Ville Syrjälä
2019-01-22 19:36 ` ✓ Fi.CI.IGT: success for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.