diff options
author | Ronald Wahl <rwahl@gmx.de> | 2018-10-10 15:54:54 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-11-21 09:24:07 +0100 |
commit | abe960b761eb6b3b32b099c80535b3d3943db040 (patch) | |
tree | 3accecc59c0572f2c172ba9e93c8fff110023c8e /drivers/clk | |
parent | f074414aff064f7167756713ebdd8622592fe350 (diff) | |
download | linux-stable-abe960b761eb6b3b32b099c80535b3d3943db040.tar.gz linux-stable-abe960b761eb6b3b32b099c80535b3d3943db040.tar.bz2 linux-stable-abe960b761eb6b3b32b099c80535b3d3943db040.zip |
clk: at91: Fix division by zero in PLL recalc_rate()
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@vger.kernel.org>
Signed-off-by: Ronald Wahl <rwahl@gmx.de>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/at91/clk-pll.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c index 72b6091eb7b9..dc7fbc796cb6 100644 --- 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_hw *hw, { struct clk_pll *pll = to_clk_pll(hw); + if (!pll->div || !pll->mul) + return 0; + return (parent_rate / pll->div) * (pll->mul + 1); } |