summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/omap3isp
diff options
context:
space:
mode:
authorLaurent Pinchart2014-09-25 14:22:00 +0200
committerMauro Carvalho Chehab2014-12-23 11:43:54 +0100
commitaadec012eabf0e5147103cfd2ffde27e5aad65e2 (patch)
treebe00b778f3a96ecd32a92892cb6cf949de4e2c00 /drivers/media/platform/omap3isp
parent[media] media/i2c/Kconfig: drop superfluous MEDIA_CONTROLLER (diff)
downloadkernel-qcow2-linux-aadec012eabf0e5147103cfd2ffde27e5aad65e2.tar.gz
kernel-qcow2-linux-aadec012eabf0e5147103cfd2ffde27e5aad65e2.tar.xz
kernel-qcow2-linux-aadec012eabf0e5147103cfd2ffde27e5aad65e2.zip
[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;