From: Laurent Pinchart Date: Thu, 25 Sep 2014 12:22:00 +0000 (-0300) Subject: [media] omap3isp: Fix division by 0 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aadec012eabf0e5147103cfd2ffde27e5aad65e2;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [media] omap3isp: Fix division by 0 If the requested clock rate passed to the XCLK set_rate or round_rate operation is 0, the driver will try to divide by 0. Fix this. Signed-off-by: Laurent Pinchart Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 51c2129bdcc6..deca80903c3a 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -220,6 +220,9 @@ static u32 isp_xclk_calc_divider(unsigned long *rate, unsigned long parent_rate) return ISPTCTRL_CTRL_DIV_BYPASS; } + if (*rate == 0) + *rate = 1; + divider = DIV_ROUND_CLOSEST(parent_rate, *rate); if (divider >= ISPTCTRL_CTRL_DIV_BYPASS) divider = ISPTCTRL_CTRL_DIV_BYPASS - 1;