[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>
This commit is contained in:
parent
584ca0252a
commit
aadec012ea
drivers/media/platform/omap3isp
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue