[Intel-gfx] [PATCH 3/5] drm/i915/vlv: warn on bad VLV PLL divider values

Jesse Barnes jbarnes at virtuousgeek.org
Fri Sep 27 21:57:24 CEST 2013


This avoids a divide by zero and warns appropriately on this serious bug.

Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8da1c96..9a83236 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5109,6 +5109,11 @@ static void vlv_crtc_clock_get(struct intel_crtc *crtc,
 	clock.p1 = (mdiv >> DPIO_P1_SHIFT) & 7;
 	clock.p2 = (mdiv >> DPIO_P2_SHIFT) & 0x1f;
 
+	if (!clock.n || !(clock.p1 * clock.p2)) {
+		WARN(1, "bad divider values on pipe %d\n", crtc->pipe);
+		return;
+	}
+
 	clock.vco = refclk * clock.m1 * clock.m2 / clock.n;
 	clock.dot = 2 * clock.vco / (clock.p1 * clock.p2);
 
-- 
1.8.3.1




More information about the Intel-gfx mailing list