summaryrefslogtreecommitdiff
path: root/drivers/media/platform/omap3isp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2014-09-25 16:22:00 +0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-12-23 13:43:54 +0300
commitaadec012eabf0e5147103cfd2ffde27e5aad65e2 (patch)
treebe00b778f3a96ecd32a92892cb6cf949de4e2c00 /drivers/media/platform/omap3isp
parent584ca0252abf31388cacbdb3018aab2c70362d8d (diff)
downloadlinux-aadec012eabf0e5147103cfd2ffde27e5aad65e2.tar.xz
[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 <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/omap3isp')
-rw-r--r--drivers/media/platform/omap3isp/isp.c3
1 files changed, 3 insertions, 0 deletions
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;