Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH v2] MIPS: ath79: Avoid using unitialized 'reg' variable
Date: Tue, 3 Sep 2013 15:38:39 +0200	[thread overview]
Message-ID: <20130903133839.GA10563@linux-mips.org> (raw)
In-Reply-To: <1377082042-4219-1-git-send-email-markos.chandras@imgtec.com>

On Wed, Aug 21, 2013 at 11:47:22AM +0100, Markos Chandras wrote:

> Fixes the following build error:
> arch/mips/include/asm/mach-ath79/ath79.h:139:20: error: 'reg' may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
> arch/mips/ath79/common.c:62:6: note: 'reg' was declared here
> In file included from arch/mips/ath79/common.c:20:0:
> arch/mips/ath79/common.c: In function 'ath79_device_reset_clear':
> arch/mips/include/asm/mach-ath79/ath79.h:139:20:
> error: 'reg' may be used uninitialized in this function
> [-Werror=maybe-uninitialized]
> arch/mips/ath79/common.c:90:6: note: 'reg' was declared here
> 
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> ---
> Changes since v1:
> http://www.linux-mips.org/archives/linux-mips/2013-08/msg00126.html
> - Remove BUG(). panic() is enough.
> http://www.linux-mips.org/archives/linux-mips/2013-08/msg00133.html
> - Change panic() message to be more accurate.
> http://www.linux-mips.org/archives/linux-mips/2013-08/msg00164.html
> ---
>  arch/mips/ath79/common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/ath79/common.c b/arch/mips/ath79/common.c
> index eb3966c..6d7a9d4 100644
> --- a/arch/mips/ath79/common.c
> +++ b/arch/mips/ath79/common.c
> @@ -75,7 +75,7 @@ void ath79_device_reset_set(u32 mask)
>  	else if (soc_is_qca955x())
>  		reg = QCA955X_RESET_REG_RESET_MODULE;
>  	else
> -		BUG();
> +		panic("Reset register not defined for this SOC");
>  
>  	spin_lock_irqsave(&ath79_device_reset_lock, flags);
>  	t = ath79_reset_rr(reg);
> @@ -103,7 +103,7 @@ void ath79_device_reset_clear(u32 mask)
>  	else if (soc_is_qca955x())
>  		reg = QCA955X_RESET_REG_RESET_MODULE;
>  	else
> -		BUG();
> +		panic("Reset register not defined for this SOC");
>  
>  	spin_lock_irqsave(&ath79_device_reset_lock, flags);
>  	t = ath79_reset_rr(reg);

Looks more like the implementation of BUG() is wrong and gcc doesn't
notice that BUG() won't return.

Was this triggered by CONFIG_BUG=n?

  Ralf

  parent reply	other threads:[~2013-09-03 13:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21 10:47 [PATCH v2] MIPS: ath79: Avoid using unitialized 'reg' variable Markos Chandras
2013-08-21 10:47 ` Markos Chandras
2013-08-21 16:40 ` Gabor Juhos
2013-09-03 13:38 ` Ralf Baechle [this message]
2013-09-03 14:03   ` Markos Chandras
2013-09-03 14:03     ` Markos Chandras
2013-09-18 13:45     ` Ralf Baechle
2013-09-18 13:51       ` Ralf Baechle

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=20130903133839.GA10563@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox