All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm, ubifs: fix gcc5.x compiler warning
Date: Mon, 30 Nov 2015 11:03:53 +0100	[thread overview]
Message-ID: <565C1F09.4090100@denx.de> (raw)
In-Reply-To: <565C14E9.2000105@myspectrum.nl>

Hello Jeroen,

Am 30.11.2015 um 10:20 schrieb Jeroen Hofstee:
> 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.

yes, you are right, it should be, but gcc 5.x seems to have problems
with it ... compiled code size for the openrd_base config is same with
my patch ...

Hmm... for the openrd_base compile local_irq_save() is used from:
arch/arm/thumb1/include/asm/proc-armv/system.h

with:
static inline void local_irq_save(
         unsigned long flags __attribute__((unused)))
{
         __asm__ __volatile__ ("" : : : "memory");
}

flasg marked as unused ... seems correct to me, but I have
no idea, why gcc 5.x prints a warning ... any ideas?

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2015-11-30 10:03 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
2015-11-30 10:03   ` Heiko Schocher [this message]
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=565C1F09.4090100@denx.de \
    --to=hs@denx.de \
    --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 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.