Re: [PATCH] kgdb: Fix warning with !CONFIG_DEBUG_RODATA

From: Jason Wessel
Date: Fri Sep 21 2012 - 17:01:57 EST


On 09/21/2012 03:59 PM, Andi Kleen wrote:
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> 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.
>

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 <jason.wessel@xxxxxxxxxxxxx>
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.

Reported-by: Thiago Rafael Becker <trbecker@xxxxxxxxxxxx>
Signed-off-by: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>

diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 3f61904..836f832 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -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 /* CONFIG_DEBUG_RODATA */

bpt->type = BP_BREAKPOINT;
err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/