* [PATCH] ARM: at91: panic when the mck rate is zero
@ 2014-03-20 16:14 Alexandre Belloni
2014-03-20 16:34 ` Boris BREZILLON
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2014-03-20 16:14 UTC (permalink / raw)
To: linux-arm-kernel
If the mck rate is zero, we'll hit the following warning:
WARNING: CPU: 0 PID: 0 at arch/arm/mach-at91/at91sam926x_time.c:257 at91sam926x_pit_init+0x13c/0x260()
But the kernel will continue to try booting and face a lot of divisions by zero
when trying to handle the various clocks.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
arch/arm/mach-at91/at91sam926x_time.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index 0f04ffe9c5a8..f060f6371392 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -250,6 +250,8 @@ void __init at91sam926x_pit_init(void)
if (IS_ERR(mck))
panic("AT91: PIT: Unable to get mck clk\n");
pit_rate = clk_get_rate(mck) / 16;
+ if (pit_rate == 0)
+ panic("AT91: PIT: can't continue, mck rate is zero\n");
pit_cycle = (pit_rate + HZ/2) / HZ;
WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] ARM: at91: panic when the mck rate is zero
2014-03-20 16:14 [PATCH] ARM: at91: panic when the mck rate is zero Alexandre Belloni
@ 2014-03-20 16:34 ` Boris BREZILLON
2014-03-20 16:40 ` Alexandre Belloni
0 siblings, 1 reply; 3+ messages in thread
From: Boris BREZILLON @ 2014-03-20 16:34 UTC (permalink / raw)
To: linux-arm-kernel
Le 20/03/2014 17:14, Alexandre Belloni a ?crit :
> If the mck rate is zero, we'll hit the following warning:
>
> WARNING: CPU: 0 PID: 0 at arch/arm/mach-at91/at91sam926x_time.c:257 at91sam926x_pit_init+0x13c/0x260()
>
> But the kernel will continue to try booting and face a lot of divisions by zero
> when trying to handle the various clocks.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> arch/arm/mach-at91/at91sam926x_time.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
> index 0f04ffe9c5a8..f060f6371392 100644
> --- a/arch/arm/mach-at91/at91sam926x_time.c
> +++ b/arch/arm/mach-at91/at91sam926x_time.c
> @@ -250,6 +250,8 @@ void __init at91sam926x_pit_init(void)
> if (IS_ERR(mck))
> panic("AT91: PIT: Unable to get mck clk\n");
> pit_rate = clk_get_rate(mck) / 16;
> + if (pit_rate == 0)
> + panic("AT91: PIT: can't continue, mck rate is zero\n");
You're testing pit_rate why not printing:
"AT91: PIT: can't continue, *pit* rate is zero\n"
Otherwise,
Acked-by: Boris BREZILLON <b.brezillon.dev@gmail.com>
> pit_cycle = (pit_rate + HZ/2) / HZ;
> WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ARM: at91: panic when the mck rate is zero
2014-03-20 16:34 ` Boris BREZILLON
@ 2014-03-20 16:40 ` Alexandre Belloni
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2014-03-20 16:40 UTC (permalink / raw)
To: linux-arm-kernel
On 20/03/2014 at 17:34:09 +0100, Boris BREZILLON wrote :
> Le 20/03/2014 17:14, Alexandre Belloni a ?crit :
> >If the mck rate is zero, we'll hit the following warning:
> >
> >WARNING: CPU: 0 PID: 0 at arch/arm/mach-at91/at91sam926x_time.c:257 at91sam926x_pit_init+0x13c/0x260()
> >
> >But the kernel will continue to try booting and face a lot of divisions by zero
> >when trying to handle the various clocks.
> >
> >Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> >---
> > arch/arm/mach-at91/at91sam926x_time.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> >diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
> >index 0f04ffe9c5a8..f060f6371392 100644
> >--- a/arch/arm/mach-at91/at91sam926x_time.c
> >+++ b/arch/arm/mach-at91/at91sam926x_time.c
> >@@ -250,6 +250,8 @@ void __init at91sam926x_pit_init(void)
> > if (IS_ERR(mck))
> > panic("AT91: PIT: Unable to get mck clk\n");
> > pit_rate = clk_get_rate(mck) / 16;
> >+ if (pit_rate == 0)
> >+ panic("AT91: PIT: can't continue, mck rate is zero\n");
> You're testing pit_rate why not printing:
>
> "AT91: PIT: can't continue, *pit* rate is zero\n"
>
pit_rate is zero because mck is zero I just didn't want to introduce a
new variable or another call to clk_get_rate(mck). I don't have any
strong opinion about that either so I can definitely make that change.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-20 16:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-20 16:14 [PATCH] ARM: at91: panic when the mck rate is zero Alexandre Belloni
2014-03-20 16:34 ` Boris BREZILLON
2014-03-20 16:40 ` Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).