gpu: ipu-v3: do not divide by zero if the pixel clock is too large
authorPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 7 Jan 2015 23:04:04 +0000 (00:04 +0100)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 23 Feb 2015 16:18:59 +0000 (17:18 +0100)
Even if an unsupported mode with a pixel clock larger than two times the
264 MHz IPU HSP clock is set, don't divide by zero.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/ipu-v3/ipu-di.c

index b61d6be97602222d3ae51b39d939d00cf8f5731b..3ddfb3d0b64d266cb95345ccb68c1a991521cc1d 100644 (file)
@@ -459,6 +459,8 @@ static void ipu_di_config_clock(struct ipu_di *di,
 
                clkrate = clk_get_rate(di->clk_ipu);
                div = DIV_ROUND_CLOSEST(clkrate, sig->mode.pixelclock);
+               if (div == 0)
+                       div = 1;
                rate = clkrate / div;
 
                error = rate / (sig->mode.pixelclock / 1000);