ARM: Fix build warning in arch/arm/mm/alignment.c
authorRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 10 Sep 2012 10:50:45 +0000 (11:50 +0100)
committerGrazvydas Ignotas <notasas@gmail.com>
Fri, 20 Feb 2015 20:11:08 +0000 (22:11 +0200)
Fix this harmless build warning:

arch/arm/mm/alignment.c: In function 'do_alignment':
arch/arm/mm/alignment.c:749:21: warning: 'offset.un' may be used uninitialized in this function

This is caused by the compiler not being able to properly analyse the
code to prove that offset.un is assigned in every case.  The case it
struggles with is where we assign the handler from the Thumb parser -
do_alignment_t32_to_handler().  As this starts by zeroing this variable
via a pointer, move it into the calling function.  This fixes the
warning.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/alignment.c

index a4d3fd3..8011bbc 100644 (file)
@@ -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;
        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 */
 
        switch (tinst1 & 0xffe0) {
        /* A6.3.5 Load/Store multiple */
@@ -853,9 +852,10 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
                break;
 
        case 0x08000000:        /* ldm or stm, or thumb-2 32bit instruction */
                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);
                        handler = do_alignment_t32_to_handler(&instr, regs, &offset);
-               else
+               else
                        handler = do_alignment_ldmstm;
                break;
 
                        handler = do_alignment_ldmstm;
                break;