Skip to contentSkip to conversation

powerpc/8xx: xmon compile fix

PATCH In review Nicholas Piggin 3 participants 5 messages Nov 29, 2016 – Nov 30, 2016 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

PATCH 1/1 powerpc/8xx: xmon compile fix

---
 arch/powerpc/xmon/xmon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/xmon/xmon.c +4 -1
index 7605455..435f5f5 100644
@@ -1213,10 +1213,13 @@ bpt_cmds(void)
 {
 	int cmd;
 	unsigned long a;
-	int mode, i;
+	int i;
 	struct bpt *bp;
+#ifndef CONFIG_8xx
+	int mode;
 	const char badaddr[] = "Only kernel addresses are permitted "
 		"for breakpoints\n";
+#endif
 
 	cmd = inchar();
 	switch (cmd) {
Signature · 1 line
2.10.2
#1 lore raw
Quoted 10 lines · Nicholas Piggin
---
 arch/powerpc/xmon/xmon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/xmon/xmon.c +0 -0
index 7605455..435f5f5 100644

arch/powerpc/xmon/xmon.c bpt_cmds(void) · line 1218

Quoted 7 lines
arch/powerpc/xmon/xmon.c +2 -1
@@ -1213,10 +1213,13 @@ bpt_cmds(void)
 {
 	int cmd;
 	unsigned long a;
-	int mode, i;
+	int i;
 	struct bpt *bp;
+#ifndef CONFIG_8xx

CONFIG_8xx is deprecated (ref arch/powerpc/platforms/Kconfig.cputype). CONFIG_PPC_8xx should be used instead.

arch/powerpc/xmon/xmon.c bpt_cmds(void) · line 1219

Quoted 1 line
arch/powerpc/xmon/xmon.c +1 -0
+	int mode;

You could also have moved this declaration inside the switch {, something like

	switch (cmd) {
#ifndef CONFIG_8xx
+		int mode;
	case 'd':

Christophe

Quoted 7 lines
arch/powerpc/xmon/xmon.c +1 -0
 	const char badaddr[] = "Only kernel addresses are permitted "
 		"for breakpoints\n";
+#endif
 
 	cmd = inchar();
 	switch (cmd) {
author reviewer
#2 lore raw
Quoted 6 lines · On Tue, 29 Nov 2016 10:06:43 +0100 Christophe LEROY <[email protected]>…
Quoted 5 lines · Nicholas Piggin
---
 arch/powerpc/xmon/xmon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 15 lines

arch/powerpc/xmon/xmon.c bpt_cmds(void) · line 1218

Quoted 12 lines
arch/powerpc/xmon/xmon.c +2 -1
index 7605455..435f5f5 100644
@@ -1213,10 +1213,13 @@ bpt_cmds(void)
 {
 	int cmd;
 	unsigned long a;
-	int mode, i;
+	int i;
 	struct bpt *bp;
+#ifndef CONFIG_8xx  

CONFIG_8xx is deprecated (ref arch/powerpc/platforms/Kconfig.cputype). CONFIG_PPC_8xx should be used instead.

Thanks for picking that up. Michael, can you adjust it if you merge please?

Quoted 5 lines

arch/powerpc/xmon/xmon.c bpt_cmds(void) · line 1219

Quoted 2 lines
arch/powerpc/xmon/xmon.c +1 -0
+	int mode;  

You could also have moved this declaration inside the switch {, something like

I tried that, couldn't decide that it was better (you also need badaddr).

Thanks,
Nick

#3 lore raw
In reply to Nicholas Piggin
Quoted 1 line · Nicholas Piggin

What's the actual error? mode/badaddr defined but not used?

I'm just curious why I've never hit it?

cheers

Quoted 21 lines
arch/powerpc/xmon/xmon.c +4 -1
index 7605455..435f5f5 100644
@@ -1213,10 +1213,13 @@ bpt_cmds(void)
 {
 	int cmd;
 	unsigned long a;
-	int mode, i;
+	int i;
 	struct bpt *bp;
+#ifndef CONFIG_8xx
+	int mode;
 	const char badaddr[] = "Only kernel addresses are permitted "
 		"for breakpoints\n";
+#endif
 
 	cmd = inchar();
 	switch (cmd) {
Signature · 1 line
2.10.2
author reviewer
#4 lore raw
Quoted 7 lines · On Wed, 30 Nov 2016 19:00:57 +1100 Michael Ellerman <[email protected]> wrote:
Quoted 1 line · Nicholas Piggin

What's the actual error? mode/badaddr defined but not used?

I'm just curious why I've never hit it?

Yes exactly. I'm not sure why you wouldn't have seen it. I'm using powerpc64 compiler to build 32-bit, but I don't think that should make a difference for this warning.

Thanks,
Nick