Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aadec012 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 584ca025
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -220,6 +220,9 @@ static u32 isp_xclk_calc_divider(unsigned long *rate, unsigned long parent_rate)
		return ISPTCTRL_CTRL_DIV_BYPASS;
		return ISPTCTRL_CTRL_DIV_BYPASS;
	}
	}


	if (*rate == 0)
		*rate = 1;

	divider = DIV_ROUND_CLOSEST(parent_rate, *rate);
	divider = DIV_ROUND_CLOSEST(parent_rate, *rate);
	if (divider >= ISPTCTRL_CTRL_DIV_BYPASS)
	if (divider >= ISPTCTRL_CTRL_DIV_BYPASS)
		divider = ISPTCTRL_CTRL_DIV_BYPASS - 1;
		divider = ISPTCTRL_CTRL_DIV_BYPASS - 1;