[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181119162619.472275187@linuxfoundation.org>
Date: Mon, 19 Nov 2018 17:29:01 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Ronald Wahl <rwahl@....de>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
Stephen Boyd <sboyd@...nel.org>
Subject: [PATCH 4.9 35/83] clk: at91: Fix division by zero in PLL recalc_rate()
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ronald Wahl <rwahl@....de>
commit 0f5cb0e6225cae2f029944cb8c74617aab6ddd49 upstream.
Commit a982e45dc150 ("clk: at91: PLL recalc_rate() now using cached MUL
and DIV values") removed a check that prevents a division by zero. This
now causes a stacktrace when booting the kernel on a at91 platform if
the PLL DIV register contains zero. This commit reintroduces this check.
Fixes: a982e45dc150 ("clk: at91: PLL recalc_rate() now using cached...")
Cc: <stable@...r.kernel.org>
Signed-off-by: Ronald Wahl <rwahl@....de>
Acked-by: Ludovic Desroches <ludovic.desroches@...rochip.com>
Signed-off-by: Stephen Boyd <sboyd@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/clk/at91/clk-pll.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/clk/at91/clk-pll.c
+++ b/drivers/clk/at91/clk-pll.c
@@ -133,6 +133,9 @@ static unsigned long clk_pll_recalc_rate
{
struct clk_pll *pll = to_clk_pll(hw);
+ if (!pll->div || !pll->mul)
+ return 0;
+
return (parent_rate / pll->div) * (pll->mul + 1);
}
Powered by blists - more mailing lists