x86: fix arch/x86/kernel/cpu/mtrr/main.c warning
authorYinghai Lu <yhlu.kernel@gmail.com>
Fri, 19 Sep 2008 06:55:27 +0000 (23:55 -0700)
committerIngo Molnar <mingo@elte.hu>
Fri, 19 Sep 2008 07:16:06 +0000 (09:16 +0200)
fix this warning reported by Andrew Morton:

> arch/x86/kernel/cpu/mtrr/main.c: In function 'mtrr_bp_init':
> arch/x86/kernel/cpu/mtrr/main.c:1170: warning: 'extra_remove_base' may be used uninitialized in this function

the warning is bogus but the logic that prevents uninitialized use
is a bit convoluted so simplify it all.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/cpu/mtrr/main.c

index b117d7f8a5640fe51091f46247671dff5d61524e..8a7c79234be65fe484af9a734a932c6e2a40d50b 100644 (file)
@@ -1218,11 +1218,10 @@ static int __init mtrr_cleanup(unsigned address_bits)
 
        memset(range, 0, sizeof(range));
        extra_remove_size = 0;
-       if (mtrr_tom2) {
-               extra_remove_base = 1 << (32 - PAGE_SHIFT);
+       extra_remove_base = 1 << (32 - PAGE_SHIFT);
+       if (mtrr_tom2)
                extra_remove_size =
                        (mtrr_tom2 >> PAGE_SHIFT) - extra_remove_base;
-       }
        nr_range = x86_get_mtrr_mem_range(range, 0, extra_remove_base,
                                          extra_remove_size);
        range_sums = sum_ranges(range, nr_range);