[PATCH 09/15] OMAPDSS: DISPC: fix div by zero issue in overlay scaling

From
Tomi Valkeinen <hidden>
Date
2015-02-26 12:49:03
Also in
linux-omap
Reply to
Tomi Valkeinen, 2015-02-26
omapdrm doesn't always configure the overlays correctly, causing the
overlay setup functions to be called with zero timings. This leads to
division by zero error.

This happens, for example, when a HDMI cable is not connected, but a
user tries to setup a plane with scaling.

Fixing omapdrm is a big job, so for now let's check for the bad timings
in DISPC and return an error.

Signed-off-by: Tomi Valkeinen <redacted>
---
 drivers/video/fbdev/omap2/dss/dispc.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c
index 8805266a52f4..1123111d3940 100644
--- a/drivers/video/fbdev/omap2/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/dss/dispc.c
@@ -2322,6 +2322,11 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk,
 	if (width = out_width && height = out_height)
 		return 0;
 
+	if (pclk = 0 || mgr_timings->pixelclock = 0) {
+		DSSERR("cannot calculate scaling settings: pclk is zero\n");
+		return -EINVAL;
+	}
+
 	if ((caps & OMAP_DSS_OVL_CAP_SCALE) = 0)
 		return -EINVAL;
 
-- 
2.3.0
Thread (15 messages) 15 messages, 1 author, last reply 2015-02-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help