ACPI / boot: Don't define unused variables
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 18 Jul 2017 15:04:16 +0000 (18:04 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 24 Jul 2017 20:47:56 +0000 (22:47 +0200)
Some code in acpi_parse_x2apic() conditionally compiled, though parts of
it are being used in any case. This annoys gcc.

arch/x86/kernel/acpi/boot.c: In function ‘acpi_parse_x2apic’:
arch/x86/kernel/acpi/boot.c:203:5: warning: variable ‘enabled’ set but not used [-Wunused-but-set-variable]
  u8 enabled;
     ^~~~~~~
arch/x86/kernel/acpi/boot.c:202:6: warning: variable ‘apic_id’ set but not used [-Wunused-but-set-variable]
  int apic_id;
      ^~~~~~~

Re-arrange the code to avoid compiling unused variables.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
arch/x86/kernel/acpi/boot.c

index 7491e73d92530bf868a9b91b2c71c892bcbdb94a..27f0240773b37ce0cfcd176351dc3a0682c8a7e0 100644 (file)
@@ -199,8 +199,10 @@ static int __init
 acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
 {
        struct acpi_madt_local_x2apic *processor = NULL;
+#ifdef CONFIG_X86_X2APIC
        int apic_id;
        u8 enabled;
+#endif
 
        processor = (struct acpi_madt_local_x2apic *)header;
 
@@ -209,9 +211,10 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
 
        acpi_table_print_madt_entry(header);
 
+#ifdef CONFIG_X86_X2APIC
        apic_id = processor->local_apic_id;
        enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
-#ifdef CONFIG_X86_X2APIC
+
        /*
         * We need to register disabled CPU as well to permit
         * counting disabled CPUs. This allows us to size