Skip to content

Commit

Permalink
OMAPDSS: DISPC: fix div by zero issue in overlay scaling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tomi Valkeinen committed Feb 26, 2015
1 parent 386f167 commit 4e1d3ca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/video/fbdev/omap2/dss/dispc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 4e1d3ca

Please sign in to comment.