* [PATCH] omap3isp: Fix division by 0
@ 2014-09-25 12:24 Laurent Pinchart
2014-09-25 21:29 ` Sakari Ailus
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Pinchart @ 2014-09-25 12:24 UTC (permalink / raw)
To: linux-media; +Cc: sakari.ailus
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] omap3isp: Fix division by 0
2014-09-25 12:24 [PATCH] omap3isp: Fix division by 0 Laurent Pinchart
@ 2014-09-25 21:29 ` Sakari Ailus
0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2014-09-25 21:29 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media
On Thu, Sep 25, 2014 at 03:24:47PM +0300, Laurent Pinchart wrote:
> 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>
Thanks!
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-25 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-25 12:24 [PATCH] omap3isp: Fix division by 0 Laurent Pinchart
2014-09-25 21:29 ` Sakari Ailus
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.