From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Fix build warning in do_alignment.
Date: Mon, 10 Sep 2012 09:40:25 +0100 [thread overview]
Message-ID: <20120910084025.GP13739@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAOAMb1CTk1_dQAUiHy5ch=UxN7vSe0of81KcKbjPjCFqR9e9tw@mail.gmail.com>
On Mon, Sep 10, 2012 at 12:25:15PM +0900, Chanho Min wrote:
> Fix the following build warning:
>
> arch/arm/mm/alignment.c: In function 'do_alignment':
> arch/arm/mm/alignment.c:327:15: warning: 'offset.un' may be used
> uninitialized in this function [-Wuninitialized]
> arch/arm/mm/alignment.c:749:21: note: 'offset.un' was declared here
>
> Signed-off-by: Chanho Min <chanho.min@lge.com>
The compiler is being silly - notice that it is saying "may" not "is".
In this case, it will not be uninitialized prior to use.
What it's caused by is do_alignment_t32_to_handler(), and its assignment
through a pointer of this variable. You can see that this is the cause
because the patch below fixes the warning.
It's all about whether gcc can prove that the variable is or is not
assigned. It has one warning for the 'provably not assigned' case, and
another for the 'can't prove that it is always assigned' case.
Anyway, normally we don't fix warnings where the compiler is wrong (but
we encourage the compiler guys to fix the compiler instead.)
arch/arm/mm/alignment.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 6d6790e..5ce7733 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -699,7 +699,6 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
unsigned long instr = *pinstr;
u16 tinst1 = (instr >> 16) & 0xffff;
u16 tinst2 = instr & 0xffff;
- poffset->un = 0;
switch (tinst1 & 0xffe0) {
/* A6.3.5 Load/Store multiple */
@@ -854,9 +853,10 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
break;
case 0x08000000: /* ldm or stm, or thumb-2 32bit instruction */
- if (thumb2_32b)
+ if (thumb2_32b) {
+ offset.un = 0;
handler = do_alignment_t32_to_handler(&instr, regs, &offset);
- else
+ } else
handler = do_alignment_ldmstm;
break;
next prev parent reply other threads:[~2012-09-10 8:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-10 3:25 [PATCH] ARM: Fix build warning in do_alignment Chanho Min
2012-09-10 8:40 ` Russell King - ARM Linux [this message]
2012-09-11 1:53 ` Chanho Min
-- strict thread matches above, loose matches on Subject: below --
2012-09-04 8:01 Chanho Min
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=20120910084025.GP13739@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).