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.pinch...@ideasonboard.com>
---
 drivers/media/platform/omap3isp/isp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 72265e5..6019156 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;
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to