intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Avoid divbyzero in modesetting
@ 2016-02-22 11:52 Tvrtko Ursulin
  2016-02-22 12:17 ` ✗ Fi.CI.BAT: failure for " Patchwork
  2016-02-22 13:09 ` [PATCH] " Maarten Lankhorst
  0 siblings, 2 replies; 8+ messages in thread
From: Tvrtko Ursulin @ 2016-02-22 11:52 UTC (permalink / raw)
  To: Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Not sure if intel_wm_config->num_pipes_active is supposed to
ever be zero when intel_update_watermarks gets called. But
since it can be triggered in early platform bringup perhaps
we want to guard against it rather than divide by zero.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index feb57598727a..2b7998889617 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2831,8 +2831,13 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
 		nth_active_pipe++;
 	}
 
-	pipe_size = ddb_size / config->num_pipes_active;
-	alloc->start = nth_active_pipe * ddb_size / config->num_pipes_active;
+	if (WARN_ON(!config->num_pipes_active)) {
+		pipe_size = 0;
+		alloc->start = 0;
+	} else {
+		pipe_size = ddb_size / config->num_pipes_active;
+		alloc->start = nth_active_pipe * ddb_size / config->num_pipes_active;
+	}
 	alloc->end = alloc->start + pipe_size;
 }
 
-- 
1.9.1

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

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

end of thread, other threads:[~2016-02-23  9:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 11:52 [PATCH] drm/i915: Avoid divbyzero in modesetting Tvrtko Ursulin
2016-02-22 12:17 ` ✗ Fi.CI.BAT: failure for " Patchwork
2016-02-22 13:09 ` [PATCH] " Maarten Lankhorst
2016-02-22 14:27   ` Tvrtko Ursulin
2016-02-22 14:56     ` Maarten Lankhorst
2016-02-22 15:22       ` Tvrtko Ursulin
2016-02-23  8:38     ` Maarten Lankhorst
2016-02-23  9:49       ` Tvrtko Ursulin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).