kgdb: Fix warning with !CONFIG_DEBUG_RODATA
PATCH 1/1 kgdb: Fix warning with !CONFIG_DEBUG_RODATA
From: Andi Kleen <[email protected]>
Fixes
arch/x86/kernel/kgdb.c: In function ‘kgdb_arch_set_breakpoint’:arch/x86/kernel/kgdb.c:749:7: warning: unused variable ‘opc’ [-Wunused-variable]
when CONFIG_DEBUG_RODATA is not defined.
--- arch/x86/kernel/kgdb.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kernel/kgdb.c +2 -0
@@ -746,7 +746,9 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)int kgdb_arch_set_breakpoint (struct kgdb_bkpt *bpt) {int err; +#ifdef CONFIG_DEBUG_RODATA char opc[BREAK_INSTR_SIZE ]; +#endif bpt->type =BP_BREAKPOINT ; err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr,
Signature · 1 line
1.7.7.6
Quoted 9 lines · Andi Kleen
From: Andi Kleen <[email protected]>
Fixes
arch/x86/kernel/kgdb.c: In function ‘kgdb_arch_set_breakpoint’:arch/x86/kernel/kgdb.c:749:7: warning: unused variable ‘opc’ [-Wunused-variable]when
CONFIG_DEBUG_RODATAis not defined.
This is already pending along with other fixes in kgdb-next / linux next for the 3.7 merge window.
Jason.
--
commit 9a15c35d16cf76482be076125f631f1193e29413
Author: Jason Wessel <[email protected]> Date: Wed Aug 8 21:12:19 2012 -0500
kgdb,x86: fix warning about unused variable
When compiling without CONFIG_DEBUG_RODATA the following compiler warning is generated:
arch/x86/kernel/kgdb.c: In function 'kgdb_arch_set_breakpoint':
arch/x86/kernel/kgdb.c:749: warning: unused variable 'opc'
The variable instantiation needs to be inside the #ifdef to make the warning go away.
arch/x86/kernel/kgdb.c +2 -0
@@ -746,7 +746,9 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ipint kgdb_arch_set_breakpoint (struct kgdb_bkpt *bpt) {int err; +#ifdef CONFIG_DEBUG_RODATA char opc[BREAK_INSTR_SIZE ]; +#endif /* CONFIG_DEBUG_RODATA */ bpt->type =BP_BREAKPOINT ; err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr,
Quoted 5 lines · Jason Wessel
Quoted 4 lines · Andi Kleen
From: Andi Kleen <[email protected]>
Fixes
Quoted 7 lines
Quoted 5 lines
arch/x86/kernel/kgdb.c: In function ‘kgdb_arch_set_breakpoint’:arch/x86/kernel/kgdb.c:749:7: warning: unused variable ‘opc’ [-Wunused-variable]when
CONFIG_DEBUG_RODATAis not defined.This is already pending along with other fixes in kgdb-next / linux next for the 3.7 merge window.
Ok. This was broken in 3.5 too. Next time please fast track warning fixes.
It's about the only warning in my standard builds.
-Andi