* [PATCH] ARM: mach-shmobile: sh7372 divide-by-zero FSIDIV fix
@ 2011-06-09 6:49 Magnus Damm
2011-06-10 2:23 ` Simon Horman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Magnus Damm @ 2011-06-09 6:49 UTC (permalink / raw)
To: linux-sh
From: Magnus Damm <damm@opensource.se>
Update the sh7372 FSIDIV clock code to bail out
with -EINVAL in case of rate is zero.
Without this fix divide-by-zero is triggering
on sh7372 platforms during system wide resume
of Suspend-to-RAM.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
arch/arm/mach-shmobile/clock-sh7372.c | 3 +++
1 file changed, 3 insertions(+)
--- 0001/arch/arm/mach-shmobile/clock-sh7372.c
+++ work/arch/arm/mach-shmobile/clock-sh7372.c 2011-06-09 15:45:41.000000000 +0900
@@ -460,6 +460,9 @@ static int fsidiv_set_rate(struct clk *c
{
int idx;
+ if (!rate)
+ return -EINVAL;
+
idx = (clk->parent->rate / rate) & 0xffff;
if (idx < 2)
return -EINVAL;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: mach-shmobile: sh7372 divide-by-zero FSIDIV fix
2011-06-09 6:49 [PATCH] ARM: mach-shmobile: sh7372 divide-by-zero FSIDIV fix Magnus Damm
@ 2011-06-10 2:23 ` Simon Horman
2011-06-10 4:54 ` Magnus Damm
2011-06-10 6:01 ` Simon Horman
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2011-06-10 2:23 UTC (permalink / raw)
To: linux-sh
On Thu, Jun 09, 2011 at 03:49:13PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
>
> Update the sh7372 FSIDIV clock code to bail out
> with -EINVAL in case of rate is zero.
>
> Without this fix divide-by-zero is triggering
> on sh7372 platforms during system wide resume
> of Suspend-to-RAM.
Hi Magnus,
I'm unsure that I understand how rate ends up being
zero in the situation you describe.
>
> Signed-off-by: Magnus Damm <damm@opensource.se>
> ---
>
> arch/arm/mach-shmobile/clock-sh7372.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> --- 0001/arch/arm/mach-shmobile/clock-sh7372.c
> +++ work/arch/arm/mach-shmobile/clock-sh7372.c 2011-06-09 15:45:41.000000000 +0900
> @@ -460,6 +460,9 @@ static int fsidiv_set_rate(struct clk *c
> {
> int idx;
>
> + if (!rate)
> + return -EINVAL;
> +
> idx = (clk->parent->rate / rate) & 0xffff;
> if (idx < 2)
> return -EINVAL;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: mach-shmobile: sh7372 divide-by-zero FSIDIV fix
2011-06-09 6:49 [PATCH] ARM: mach-shmobile: sh7372 divide-by-zero FSIDIV fix Magnus Damm
2011-06-10 2:23 ` Simon Horman
@ 2011-06-10 4:54 ` Magnus Damm
2011-06-10 6:01 ` Simon Horman
2 siblings, 0 replies; 4+ messages in thread
From: Magnus Damm @ 2011-06-10 4:54 UTC (permalink / raw)
To: linux-sh
On Fri, Jun 10, 2011 at 11:23 AM, Simon Horman <horms@verge.net.au> wrote:
> On Thu, Jun 09, 2011 at 03:49:13PM +0900, Magnus Damm wrote:
>> From: Magnus Damm <damm@opensource.se>
>>
>> Update the sh7372 FSIDIV clock code to bail out
>> with -EINVAL in case of rate is zero.
>>
>> Without this fix divide-by-zero is triggering
>> on sh7372 platforms during system wide resume
>> of Suspend-to-RAM.
>
> Hi Magnus,
>
> I'm unsure that I understand how rate ends up being
> zero in the situation you describe.
Hi Simon,
During Suspend-to-RAM resume the function clks_core_resume() in
drivers/sh/clk/core.c gets executed. This function goes through all
clocks and sets their rate. In some cases the rate happens to be zero,
and for the FSIDIV the zero turns into a divide-by-zero.
This can easily be triggered by using Suspend-to-RAM on for instance a
Mackerel board.
/ magnus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: mach-shmobile: sh7372 divide-by-zero FSIDIV fix
2011-06-09 6:49 [PATCH] ARM: mach-shmobile: sh7372 divide-by-zero FSIDIV fix Magnus Damm
2011-06-10 2:23 ` Simon Horman
2011-06-10 4:54 ` Magnus Damm
@ 2011-06-10 6:01 ` Simon Horman
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2011-06-10 6:01 UTC (permalink / raw)
To: linux-sh
On Fri, Jun 10, 2011 at 01:54:47PM +0900, Magnus Damm wrote:
> On Fri, Jun 10, 2011 at 11:23 AM, Simon Horman <horms@verge.net.au> wrote:
> > On Thu, Jun 09, 2011 at 03:49:13PM +0900, Magnus Damm wrote:
> >> From: Magnus Damm <damm@opensource.se>
> >>
> >> Update the sh7372 FSIDIV clock code to bail out
> >> with -EINVAL in case of rate is zero.
> >>
> >> Without this fix divide-by-zero is triggering
> >> on sh7372 platforms during system wide resume
> >> of Suspend-to-RAM.
> >
> > Hi Magnus,
> >
> > I'm unsure that I understand how rate ends up being
> > zero in the situation you describe.
>
> Hi Simon,
>
> During Suspend-to-RAM resume the function clks_core_resume() in
> drivers/sh/clk/core.c gets executed. This function goes through all
> clocks and sets their rate. In some cases the rate happens to be zero,
> and for the FSIDIV the zero turns into a divide-by-zero.
Ok, understood.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-10 6:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-09 6:49 [PATCH] ARM: mach-shmobile: sh7372 divide-by-zero FSIDIV fix Magnus Damm
2011-06-10 2:23 ` Simon Horman
2011-06-10 4:54 ` Magnus Damm
2011-06-10 6:01 ` Simon Horman
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.