All of lore.kernel.org
 help / color / mirror / Atom feed
From: alexandre.belloni@free-electrons.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: at91: panic when the mck rate is zero
Date: Thu, 20 Mar 2014 17:40:04 +0100	[thread overview]
Message-ID: <20140320164003.GV12021@piout.net> (raw)
In-Reply-To: <532B1881.2050409@gmail.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Boris BREZILLON <b.brezillon.dev@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] ARM: at91: panic when the mck rate is zero
Date: Thu, 20 Mar 2014 17:40:04 +0100	[thread overview]
Message-ID: <20140320164003.GV12021@piout.net> (raw)
In-Reply-To: <532B1881.2050409@gmail.com>

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

  reply	other threads:[~2014-03-20 16:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 16:14 [PATCH] ARM: at91: panic when the mck rate is zero Alexandre Belloni
2014-03-20 16:14 ` Alexandre Belloni
2014-03-20 16:34 ` Boris BREZILLON
2014-03-20 16:34   ` Boris BREZILLON
2014-03-20 16:40   ` Alexandre Belloni [this message]
2014-03-20 16:40     ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140320164003.GV12021@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.