Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1689049

[PATCH v2 1/5] ACPI / boot: Don't define unused variables

From Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH v2 1/5] ACPI / boot: Don't define unused variables
Date 2017-07-17 15:40 +0200
Message-ID <u4epJ-5H0-45@gated-at.bofh.it> (permalink)
References <u4eg2-5DQ-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 arch/x86/kernel/acpi/boot.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 6bb680671088..09ddb3cd627a 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -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
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[Resend, PATCH v2 0/5] ACPI / boot: Few amendments Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-07-17 15:40 +0200
  [PATCH v2 2/5] ACPI / boot: Correct address space of __acpi_map_table() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-07-17 15:40 +0200
    Re: [PATCH v2 2/5] ACPI / boot: Correct address space of  __acpi_map_table() Hanjun Guo <guohanjun@huawei.com> - 2017-07-18 11:50 +0200
  [PATCH v2 3/5] ACPI / boot: Add number of legacy IRQs to debug output Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-07-17 15:40 +0200
  [PATCH v2 1/5] ACPI / boot: Don't define unused variables Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-07-17 15:40 +0200

csiph-web