Patchwork [U-Boot] Fix compile issue in arch/arm/lib/board.c

login
register
mail settings
Submitter Marek Vasut
Date Oct. 24, 2011, 9:12 a.m.
Message ID <1319447521-6020-1-git-send-email-marek.vasut@gmail.com>
Download mbox | patch
Permalink /patch/121301/
State Superseded
Headers show

Comments

Marek Vasut - Oct. 24, 2011, 9:12 a.m.
The commit dc8bbea0170eb2aca428ea221c91fc2e5e11f199 breaks the build of U-Boot
if CONFIG_CMD_NET is enabled.

arm: Use getenv_ulong() in place of getenv(), strtoul

This changes the board code to use the new getenv_ulong() function.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
---
 arch/arm/lib/board.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Heiko Schocher - Oct. 24, 2011, 9:25 a.m.
Hello Marek,

Marek Vasut wrote:
> The commit dc8bbea0170eb2aca428ea221c91fc2e5e11f199 breaks the build of U-Boot
> if CONFIG_CMD_NET is enabled.
> 
> arm: Use getenv_ulong() in place of getenv(), strtoul
> 
> This changes the board code to use the new getenv_ulong() function.
> 
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
> ---
>  arch/arm/lib/board.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index c764844..558e973 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -566,7 +566,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
>  	/* Initialize from environment */
>  	load_addr = getenv_ulong("loadaddr", 16, load_addr);
>  #if defined(CONFIG_CMD_NET)
> -	s = getenv("bootfile");
> +	char *s = getenv("bootfile");

Did you compiled this? I think, this should generate a compiler warning.

>  	if (s != NULL)
>  		copy_filename(BootFile, s, sizeof(BootFile));
>  #endif

bye,
Heiko
Marek Vasut - Oct. 24, 2011, 9:31 a.m.
On Monday, October 24, 2011 11:25:32 AM Heiko Schocher wrote:
> Hello Marek,
> 
> Marek Vasut wrote:
> > The commit dc8bbea0170eb2aca428ea221c91fc2e5e11f199 breaks the build of
> > U-Boot if CONFIG_CMD_NET is enabled.
> > 
> > arm: Use getenv_ulong() in place of getenv(), strtoul
> > 
> > This changes the board code to use the new getenv_ulong() function.
> > 
> > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Simon Glass <sjg@chromium.org>
> > Cc: Wolfgang Denk <wd@denx.de>
> > Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
> > ---
> > 
> >  arch/arm/lib/board.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> > index c764844..558e973 100644
> > --- a/arch/arm/lib/board.c
> > +++ b/arch/arm/lib/board.c
> > @@ -566,7 +566,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
> > 
> >  	/* Initialize from environment */
> >  	load_addr = getenv_ulong("loadaddr", 16, load_addr);
> >  
> >  #if defined(CONFIG_CMD_NET)
> > 
> > -	s = getenv("bootfile");
> > +	char *s = getenv("bootfile");
> 
> Did you compiled this? I think, this should generate a compiler warning.
> 
> >  	if (s != NULL)
> >  	
> >  		copy_filename(BootFile, s, sizeof(BootFile));
> >  
> >  #endif
> 
> bye,
> Heiko

Hey Heiko,

I did and it does not. I found that on a phycore pcm037 with ELDK5. But I just 
replied your patch should be used ;-)

Cheers
Wolfgang Denk - Oct. 24, 2011, 7:23 p.m.
Dear Marek Vasut,

In message <1319447521-6020-1-git-send-email-marek.vasut@gmail.com> you wrote:
> The commit dc8bbea0170eb2aca428ea221c91fc2e5e11f199 breaks the build of U-Boot
> if CONFIG_CMD_NET is enabled.
> 
> arm: Use getenv_ulong() in place of getenv(), strtoul
> 
> This changes the board code to use the new getenv_ulong() function.
> 
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
> ---
>  arch/arm/lib/board.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index c764844..558e973 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -566,7 +566,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
>  	/* Initialize from environment */
>  	load_addr = getenv_ulong("loadaddr", 16, load_addr);
>  #if defined(CONFIG_CMD_NET)
> -	s = getenv("bootfile");
> +	char *s = getenv("bootfile");

Never mix declarations with code.

[no need to resubmit, I applied Simon's patch instead.]

Best regards,

Wolfgang Denk

Patch

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index c764844..558e973 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -566,7 +566,7 @@  void board_init_r(gd_t *id, ulong dest_addr)
 	/* Initialize from environment */
 	load_addr = getenv_ulong("loadaddr", 16, load_addr);
 #if defined(CONFIG_CMD_NET)
-	s = getenv("bootfile");
+	char *s = getenv("bootfile");
 	if (s != NULL)
 		copy_filename(BootFile, s, sizeof(BootFile));
 #endif