* [PATCH] MIPS: bcm63xx: cpu: Replace BUG() with panic()
@ 2013-09-30 8:38 ` Markos Chandras
0 siblings, 0 replies; 4+ messages in thread
From: Markos Chandras @ 2013-09-30 8:38 UTC (permalink / raw)
To: linux-mips; +Cc: Markos Chandras
BUG() can be a noop if CONFIG_BUG is not selected,
leading to the following build problem on a randconfig:
arch/mips/bcm63xx/cpu.c: In function 'detect_cpu_clock':
arch/mips/bcm63xx/cpu.c:254:1: error: control reaches end of
non-void function [-Werror=return-type]
We fix this problem by replacing BUG() with panic() since it's
best to handle the case of an unknown board instead of silently
returning a random clock frequency.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
---
This patch is for the upstream-sfr/mips-for-linux-next tree
---
arch/mips/bcm63xx/cpu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index b713cd6..88c57cc 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -123,7 +123,9 @@ unsigned int bcm63xx_get_memory_size(void)
static unsigned int detect_cpu_clock(void)
{
- switch (bcm63xx_get_cpu_id()) {
+ u16 cpu_id = bcm63xx_get_cpu_id();
+
+ switch (cpu_id) {
case BCM3368_CPU_ID:
return 300000000;
@@ -249,7 +251,7 @@ static unsigned int detect_cpu_clock(void)
}
default:
- BUG();
+ panic("Failed to detect clock for CPU with id=%04d\n", cpu_id);
}
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH] MIPS: bcm63xx: cpu: Replace BUG() with panic()
@ 2013-09-30 8:38 ` Markos Chandras
0 siblings, 0 replies; 4+ messages in thread
From: Markos Chandras @ 2013-09-30 8:38 UTC (permalink / raw)
To: linux-mips; +Cc: Markos Chandras
BUG() can be a noop if CONFIG_BUG is not selected,
leading to the following build problem on a randconfig:
arch/mips/bcm63xx/cpu.c: In function 'detect_cpu_clock':
arch/mips/bcm63xx/cpu.c:254:1: error: control reaches end of
non-void function [-Werror=return-type]
We fix this problem by replacing BUG() with panic() since it's
best to handle the case of an unknown board instead of silently
returning a random clock frequency.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
---
This patch is for the upstream-sfr/mips-for-linux-next tree
---
arch/mips/bcm63xx/cpu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index b713cd6..88c57cc 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -123,7 +123,9 @@ unsigned int bcm63xx_get_memory_size(void)
static unsigned int detect_cpu_clock(void)
{
- switch (bcm63xx_get_cpu_id()) {
+ u16 cpu_id = bcm63xx_get_cpu_id();
+
+ switch (cpu_id) {
case BCM3368_CPU_ID:
return 300000000;
@@ -249,7 +251,7 @@ static unsigned int detect_cpu_clock(void)
}
default:
- BUG();
+ panic("Failed to detect clock for CPU with id=%04d\n", cpu_id);
}
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] MIPS: bcm63xx: cpu: Replace BUG() with panic()
2013-09-30 8:38 ` Markos Chandras
(?)
@ 2013-12-21 19:08 ` Jonas Gorski
2013-12-21 19:08 ` John Crispin
-1 siblings, 1 reply; 4+ messages in thread
From: Jonas Gorski @ 2013-12-21 19:08 UTC (permalink / raw)
To: Markos Chandras; +Cc: MIPS Mailing List
Hi,
On Mon, Sep 30, 2013 at 10:38 AM, Markos Chandras
<markos.chandras@imgtec.com> wrote:
> BUG() can be a noop if CONFIG_BUG is not selected,
> leading to the following build problem on a randconfig:
>
> arch/mips/bcm63xx/cpu.c: In function 'detect_cpu_clock':
> arch/mips/bcm63xx/cpu.c:254:1: error: control reaches end of
> non-void function [-Werror=return-type]
>
> We fix this problem by replacing BUG() with panic() since it's
> best to handle the case of an unknown board instead of silently
> returning a random clock frequency.
>
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> Acked-by: Steven J. Hill <Steven.Hill@imgtec.com>
The patch seems mostly okay, although there tend to be quite a few
places treating BUG() as unreachable() - for my part BUG() not being
unreachable for BUG=n is a bug, but that's a different story ;) One
nitpick though ...
> ---
> This patch is for the upstream-sfr/mips-for-linux-next tree
> ---
> arch/mips/bcm63xx/cpu.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
> index b713cd6..88c57cc 100644
> --- a/arch/mips/bcm63xx/cpu.c
> +++ b/arch/mips/bcm63xx/cpu.c
> @@ -123,7 +123,9 @@ unsigned int bcm63xx_get_memory_size(void)
>
> static unsigned int detect_cpu_clock(void)
> {
> - switch (bcm63xx_get_cpu_id()) {
> + u16 cpu_id = bcm63xx_get_cpu_id();
> +
> + switch (cpu_id) {
> case BCM3368_CPU_ID:
> return 300000000;
>
> @@ -249,7 +251,7 @@ static unsigned int detect_cpu_clock(void)
> }
>
> default:
> - BUG();
> + panic("Failed to detect clock for CPU with id=%04d\n", cpu_id);
The cpu_id is in hex, so it needs to be %04x - not that it matters
much since early printk won't work yet at this stage anyway IIRC.
with this fixed (maybe John is nice enough to replace the one character ;),
Acked-by: Jonas Gorski <jogo@openwrt.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] MIPS: bcm63xx: cpu: Replace BUG() with panic()
2013-12-21 19:08 ` Jonas Gorski
@ 2013-12-21 19:08 ` John Crispin
0 siblings, 0 replies; 4+ messages in thread
From: John Crispin @ 2013-12-21 19:08 UTC (permalink / raw)
To: linux-mips
On 21/12/13 20:08, Jonas Gorski wrote:
> The cpu_id is in hex, so it needs to be %04x - not that it matters
> much since early printk won't work yet at this stage anyway IIRC.
>
> with this fixed (maybe John is nice enough to replace the one character;),
>
> Acked-by: Jonas Gorski<jogo@openwrt.org>
i'll fold the nitpick while merging
John
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-21 19:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 8:38 [PATCH] MIPS: bcm63xx: cpu: Replace BUG() with panic() Markos Chandras
2013-09-30 8:38 ` Markos Chandras
2013-12-21 19:08 ` Jonas Gorski
2013-12-21 19:08 ` John Crispin
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.