* [PATCH] clk: at91: Fix division by zero in PLL recalc_rate()
@ 2018-10-10 10:31 Ronald WAHL
2018-10-10 13:26 ` Ludovic Desroches
0 siblings, 1 reply; 3+ messages in thread
From: Ronald WAHL @ 2018-10-10 10:31 UTC (permalink / raw)
To: linux-arm-kernel
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 <ronald.wahl@raritan.com>
---
drivers/clk/at91/clk-pll.c | 3 +++
1 file changed, 3 insertions(+)
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);
}
--
2.17.1
________________________________
Ce message, ainsi que tous les fichiers joints ? ce message, peuvent contenir des informations sensibles et/ ou confidentielles ne devant pas ?tre divulgu?es. Si vous n'?tes pas le destinataire de ce message (ou que vous recevez ce message par erreur), nous vous remercions de le notifier imm?diatement ? son exp?diteur, et de d?truire ce message. Toute copie, divulgation, modification, utilisation ou diffusion, non autoris?e, directe ou indirecte, de tout ou partie de ce message, est strictement interdite.
This e-mail, and any document attached hereby, may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized, direct or indirect, copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] clk: at91: Fix division by zero in PLL recalc_rate()
2018-10-10 10:31 [PATCH] clk: at91: Fix division by zero in PLL recalc_rate() Ronald WAHL
@ 2018-10-10 13:26 ` Ludovic Desroches
2018-10-10 13:43 ` Ronald WAHL
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Desroches @ 2018-10-10 13:26 UTC (permalink / raw)
To: linux-arm-kernel
Hi Ronald,
On Wed, Oct 10, 2018 at 10:31:31AM +0000, Ronald WAHL wrote:
> 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 <ronald.wahl@raritan.com>
> ---
> drivers/clk/at91/clk-pll.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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);
> }
Weird indentation here. Patch doesn't apply.
Otherwise,
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Regards
Ludovic
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] clk: at91: Fix division by zero in PLL recalc_rate()
2018-10-10 13:26 ` Ludovic Desroches
@ 2018-10-10 13:43 ` Ronald WAHL
0 siblings, 0 replies; 3+ messages in thread
From: Ronald WAHL @ 2018-10-10 13:43 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
argh, this is probably caused by the mail server of my company. I'll
resent the patch over a different provider hoping it works then. Sorry.
- ron
On 10.10.18 15:26, Ludovic Desroches wrote:
> Hi Ronald,
>
> On Wed, Oct 10, 2018 at 10:31:31AM +0000, Ronald WAHL wrote:
>> 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 <ronald.wahl@raritan.com>
>> ---
>> drivers/clk/at91/clk-pll.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> 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);
>> }
>
> Weird indentation here. Patch doesn't apply.
>
> Otherwise,
> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
>
> Regards
>
> Ludovic
>
--
Ronald Wahl
Principal Software Engineer, Raritan Deutschland GmbH
Kornmarkt 7, 08056 Zwickau, Germany
Amtsgericht Chemnitz HRB 23605, Gesch?ftsf?hrung: Ralf Ploenes
________________________________
Ce message, ainsi que tous les fichiers joints ? ce message, peuvent contenir des informations sensibles et/ ou confidentielles ne devant pas ?tre divulgu?es. Si vous n'?tes pas le destinataire de ce message (ou que vous recevez ce message par erreur), nous vous remercions de le notifier imm?diatement ? son exp?diteur, et de d?truire ce message. Toute copie, divulgation, modification, utilisation ou diffusion, non autoris?e, directe ou indirecte, de tout ou partie de ce message, est strictement interdite.
This e-mail, and any document attached hereby, may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized, direct or indirect, copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-10 13:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 10:31 [PATCH] clk: at91: Fix division by zero in PLL recalc_rate() Ronald WAHL
2018-10-10 13:26 ` Ludovic Desroches
2018-10-10 13:43 ` Ronald WAHL
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.