public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jeroen Hofstee <dasuboot@myspectrum.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm, ubifs: fix gcc5.x compiler warning
Date: Mon, 30 Nov 2015 10:20:41 +0100	[thread overview]
Message-ID: <565C14E9.2000105@myspectrum.nl> (raw)
In-Reply-To: <1448869662-23191-1-git-send-email-hs@denx.de>

Hello Heiko,

On 30-11-15 08:47, Heiko Schocher wrote:
> compiling U-Boot for openrd_base_defconfig with
> gcc 5.x shows the following warning:
>
>    CC      fs/ubifs/super.o
> In file included from fs/ubifs/ubifs.h:35:0,
>                   from fs/ubifs/super.c:37:
> fs/ubifs/super.c: In function 'atomic_inc':
> ./arch/arm/include/asm/atomic.h:55:2: warning: 'flags' is used uninitialized in this function [-Wuninitialized]
>    local_irq_save(flags);
>    ^
> fs/ubifs/super.c: In function 'atomic_dec':
> ./arch/arm/include/asm/atomic.h:64:2: warning: 'flags' is used uninitialized in this function [-Wuninitialized]
>    local_irq_save(flags);
>    ^
>    CC      fs/ubifs/sb.o
> [...]
>    CC      fs/ubifs/lpt.o
> In file included from include/linux/bitops.h:123:0,
>                   from include/common.h:20,
>                   from include/ubi_uboot.h:17,
>                   from fs/ubifs/ubifs.h:37,
>                   from fs/ubifs/lpt.c:35:
> fs/ubifs/lpt.c: In function 'test_and_set_bit':
> ./arch/arm/include/asm/bitops.h:57:2: warning: 'flags' is used uninitialized in this function [-Wuninitialized]
>    local_irq_save(flags);
>    ^
>    CC      fs/ubifs/lpt_commit.o
> In file included from include/linux/bitops.h:123:0,
>                   from include/common.h:20,
>                   from include/ubi_uboot.h:17,
>                   from fs/ubifs/ubifs.h:37,
>                   from fs/ubifs/lpt_commit.c:26:
> fs/ubifs/lpt_commit.c: In function 'test_and_set_bit':
> ./arch/arm/include/asm/bitops.h:57:2: warning: 'flags' is used uninitialized in this function [-Wuninitialized]
>    local_irq_save(flags);
>    ^
>    CC      fs/ubifs/scan.o
>    CC      fs/ubifs/lprops.o
>    CC      fs/ubifs/tnc.o
> In file included from include/linux/bitops.h:123:0,
>                   from include/common.h:20,
>                   from include/ubi_uboot.h:17,
>                   from fs/ubifs/ubifs.h:37,
>                   from fs/ubifs/tnc.c:30:
> fs/ubifs/tnc.c: In function 'test_and_set_bit':
> ./arch/arm/include/asm/bitops.h:57:2: warning: 'flags' is used uninitialized in this function [-Wuninitialized]
>    local_irq_save(flags);
>    ^
>    CC      fs/ubifs/tnc_misc.o
>
> Fix it.
>
> Signed-off-by: Heiko Schocher <hs@denx.de>
> ---
>
>   arch/arm/include/asm/atomic.h | 14 +++++++-------
>   arch/arm/include/asm/bitops.h |  4 ++--
>   2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
> index 34c07fe..9b79506 100644
> --- a/arch/arm/include/asm/atomic.h
> +++ b/arch/arm/include/asm/atomic.h
> @@ -32,7 +32,7 @@ typedef struct { volatile int counter; } atomic_t;
>   
>   static inline void atomic_add(int i, volatile atomic_t *v)
>   {
> -	unsigned long flags;
> +	unsigned long flags = 0;
>   
>   	local_irq_save(flags);
>   	v->counter += i;
> @@ -41,7 +41,7 @@ static inline void atomic_add(int i, volatile atomic_t *v)
>   

Since flags is an "out" argument, something else must be wrong.
There should be no need to initialize it, since local_irq_save should
do that afaik.

Regards,
Jeroen

  reply	other threads:[~2015-11-30  9:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30  7:47 [U-Boot] [PATCH] arm, ubifs: fix gcc5.x compiler warning Heiko Schocher
2015-11-30  9:20 ` Jeroen Hofstee [this message]
2015-11-30 10:03   ` Heiko Schocher
2015-11-30 16:28     ` Tom Rini
2015-12-01  7:56       ` Albert ARIBAUD
2015-12-02 14:39         ` Tom Rini
2015-11-30 23:48     ` Jeroen Hofstee
2016-01-20 21:00 ` [U-Boot] " Tom Rini

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=565C14E9.2000105@myspectrum.nl \
    --to=dasuboot@myspectrum.nl \
    --cc=u-boot@lists.denx.de \
    /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