* [PATCH] kgbd: clear compilation warning
@ 2012-05-11 4:13 Thiago Rafael Becker
2012-05-11 6:23 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Thiago Rafael Becker @ 2012-05-11 4:13 UTC (permalink / raw)
To: linux-kernel, kernel-janitors
Cc: Thiago Rafael Becker, tglx, mingo, hpa, x86, a.p.zijlstra,
jason.wessel, jan.kiszka, dhowells
In the function kgbd_arch_set_breakpoint, the variable is only used
if DEBUG_RODATA is configured. This clears the following compilation
warning:
arch/x86/kernel/kgdb.c:749:7: warning: unused variable 'opc'
Signed-off-by: Thiago Rafael Becker <trbecker@trbecker.org>
---
arch/x86/kernel/kgdb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 8bfb614..7c54c78 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -746,7 +746,6 @@ void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
{
int err;
- char opc[BREAK_INSTR_SIZE];
bpt->type = BP_BREAKPOINT;
err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr,
@@ -756,6 +755,8 @@ int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
err = probe_kernel_write((char *)bpt->bpt_addr,
arch_kgdb_ops.gdb_bpt_instr, BREAK_INSTR_SIZE);
#ifdef CONFIG_DEBUG_RODATA
+ char opc[BREAK_INSTR_SIZE];
+
if (!err)
return err;
/*
--
1.7.10.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kgbd: clear compilation warning
2012-05-11 4:13 [PATCH] kgbd: clear compilation warning Thiago Rafael Becker
@ 2012-05-11 6:23 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2012-05-11 6:23 UTC (permalink / raw)
To: Thiago Rafael Becker
Cc: linux-kernel, kernel-janitors, tglx, mingo, hpa, x86,
a.p.zijlstra, jason.wessel, jan.kiszka, dhowells
On Fri, May 11, 2012 at 01:13:40AM -0300, Thiago Rafael Becker wrote:
> In the function kgbd_arch_set_breakpoint, the variable is only used
> if DEBUG_RODATA is configured. This clears the following compilation
> warning:
>
> arch/x86/kernel/kgdb.c:749:7: warning: unused variable 'opc'
>
This doesn't work. Now there is a "warning: mixing declarations and
code" warning message for people who have CONFIG_DEBUG_RODATA
turned on.
I sent one of these yesterday where I did:
if (!config_enabled(CONFIG_DEBUG_RODATA))
return err;
But test it both ways and do a make arch/x86/kernel/kgdb.i and
make sure the code looks ok.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-11 6:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-11 4:13 [PATCH] kgbd: clear compilation warning Thiago Rafael Becker
2012-05-11 6:23 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox