]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
OMAPDSS: DISPC: fix div by zero issue in overlay scaling
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 3 Oct 2014 15:14:09 +0000 (15:14 +0000)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 26 Feb 2015 10:15:13 +0000 (12:15 +0200)
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 <tomi.valkeinen@ti.com>
drivers/video/fbdev/omap2/dss/dispc.c

index 8805266a52f411b7a27f431ca7c97b26b897a8ef..1123111d394023f58c3b1e29d876f4d45d5aed77 100644 (file)
@@ -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;