Skip to contentSkip to conversation

nios2: Fix unused variable warning

PATCH In review Marek Vasut 3 participants 3 messages Sep 19, 2015 – Oct 1, 2015 NIOS2 architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nios2: Fix unused variable warning

Fix the following compiler splat by adding __maybe_unused annotation to the variable. Using this particular annotation has the least ugly impact on the code compared to using ifdeffery.

arch/nios2/kernel/setup.c: In function 'nios2_boot_init':
arch/nios2/kernel/setup.c:107:7: warning: unused variable 'cmdline_passed' [-Wunused-variable]

  char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
       ^
---
 arch/nios2/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/nios2/kernel/setup.c +1 -1
index b101a43..a4ff86d 100644
@@ -104,7 +104,7 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
 				       unsigned r7)
 {
 	unsigned dtb_passed = 0;
-	char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
+	char cmdline_passed[COMMAND_LINE_SIZE] __maybe_unused = { 0, };
 
 #if defined(CONFIG_NIOS2_PASS_CMDLINE)
 	if (r4 == 0x534f494e) { /* r4 is magic NIOS */
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Marek Vasut

Fix the following compiler splat by adding __maybe_unused annotation to the variable. Using this particular annotation has the least ugly impact on the code compared to using ifdeffery.

arch/nios2/kernel/setup.c: In function 'nios2_boot_init':
arch/nios2/kernel/setup.c:107:7: warning: unused variable 'cmdline_passed' [-Wunused-variable]

  char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
       ^
Acked-by
#2 lore raw
Quoted 10 lines · Tobias Klauser
Quoted 9 lines · Marek Vasut

Fix the following compiler splat by adding __maybe_unused annotation to the variable. Using this particular annotation has the least ugly impact on the code compared to using ifdeffery.

arch/nios2/kernel/setup.c: In function 'nios2_boot_init':
arch/nios2/kernel/setup.c:107:7: warning: unused variable 'cmdline_passed' [-Wunused-variable]

  char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
       ^
Quoted 4 lines
Quoted 1 line

--