diff mbox

powerpc/8xx: xmon compile fix

Message ID 20161129085654.1967-1-npiggin@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Nicholas Piggin Nov. 29, 2016, 8:56 a.m. UTC
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/xmon/xmon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Christophe Leroy Nov. 29, 2016, 9:06 a.m. UTC | #1
Le 29/11/2016 à 09:56, Nicholas Piggin a écrit :
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  arch/powerpc/xmon/xmon.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index 7605455..435f5f5 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -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.

> +	int mode;

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

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


Christophe

>  	const char badaddr[] = "Only kernel addresses are permitted "
>  		"for breakpoints\n";
> +#endif
>
>  	cmd = inchar();
>  	switch (cmd) {
>
Nicholas Piggin Nov. 29, 2016, 9:53 a.m. UTC | #2
On Tue, 29 Nov 2016 10:06:43 +0100
Christophe LEROY <christophe.leroy@c-s.fr> wrote:

> Le 29/11/2016 à 09:56, Nicholas Piggin a écrit :
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> >  arch/powerpc/xmon/xmon.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> > index 7605455..435f5f5 100644
> > --- a/arch/powerpc/xmon/xmon.c
> > +++ b/arch/powerpc/xmon/xmon.c
> > @@ -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?

> 
> > +	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
Michael Ellerman Nov. 30, 2016, 8 a.m. UTC | #3
Nicholas Piggin <npiggin@gmail.com> writes:

> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

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

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

cheers

> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index 7605455..435f5f5 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -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) {
> -- 
> 2.10.2
Nicholas Piggin Nov. 30, 2016, 8:08 a.m. UTC | #4
On Wed, 30 Nov 2016 19:00:57 +1100
Michael Ellerman <mpe@ellerman.id.au> wrote:

> Nicholas Piggin <npiggin@gmail.com> writes:
> 
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>  
> 
> 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
diff mbox

Patch

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 7605455..435f5f5 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -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) {