Patchwork [U-Boot] arch/powerpc/lib/board.c: fix build warning

login
register
mail settings
Submitter Wolfgang Denk
Date Oct. 23, 2011, 9:58 p.m.
Message ID <1319407132-6590-1-git-send-email-wd@denx.de>
Download mbox | patch
Permalink /patch/121254/
State Accepted
Headers show

Comments

Wolfgang Denk - Oct. 23, 2011, 9:58 p.m.
Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(),
strtoul" instroduced a build warning for some PPC systems:

board.c: In function 'board_init_r':
board.c:626: warning: unused variable 's'

Fix it.

Signed-off-by: Wolfgang Denk <wd@denx.de>
---
 arch/powerpc/lib/board.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
Simon Glass - Oct. 24, 2011, 3:49 a.m.
Hi Wolfgang,

On Sun, Oct 23, 2011 at 2:58 PM, Wolfgang Denk <wd@denx.de> wrote:
> Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(),
> strtoul" instroduced a build warning for some PPC systems:
>
> board.c: In function 'board_init_r':
> board.c:626: warning: unused variable 's'
>
> Fix it.
>
> Signed-off-by: Wolfgang Denk <wd@denx.de>

I sent an alternative to this but they are roughly equivalent so:

Acked-by: Simon Glass <sjg@chromium.org>

Thanks for fixing this.

Regards,
Simon

> ---
>  arch/powerpc/lib/board.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
> index 6cb0ed6..aff1a0c 100644
> --- a/arch/powerpc/lib/board.c
> +++ b/arch/powerpc/lib/board.c
> @@ -623,10 +623,11 @@ void board_init_f (ulong bootflag)
>  */
>  void board_init_r (gd_t *id, ulong dest_addr)
>  {
> -       char *s;
>        bd_t *bd;
>        ulong malloc_start;
> -
> +#if defined(CONFIG_SYS_FLASH_CHECKSUM) || defined(CONFIG_CMD_NET)
> +       char *s;
> +#endif
>  #ifndef CONFIG_SYS_NO_FLASH
>        ulong flash_size;
>  #endif
> --
> 1.7.6.2
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
Heiko Schocher - Oct. 24, 2011, 6:53 a.m.
Hello Simon, Wolfgang,

Simon Glass wrote:
> Hi Wolfgang,
> 
> On Sun, Oct 23, 2011 at 2:58 PM, Wolfgang Denk <wd@denx.de> wrote:
>> Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(),
>> strtoul" instroduced a build warning for some PPC systems:
>>
>> board.c: In function 'board_init_r':
>> board.c:626: warning: unused variable 's'
>>
>> Fix it.
>>
>> Signed-off-by: Wolfgang Denk <wd@denx.de>
> 
> I sent an alternative to this but they are roughly equivalent so:
> 
> Acked-by: Simon Glass <sjg@chromium.org>

Same on arm, posted for this a patch.

Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
Wolfgang Denk - Nov. 3, 2011, 7:09 p.m.
Dear Wolfgang Denk,

In message <1319407132-6590-1-git-send-email-wd@denx.de> you wrote:
> Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(),
> strtoul" instroduced a build warning for some PPC systems:
> 
> board.c: In function 'board_init_r':
> board.c:626: warning: unused variable 's'
> 
> Fix it.
> 
> Signed-off-by: Wolfgang Denk <wd@denx.de>
> ---
>  arch/powerpc/lib/board.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
Kumar Gala - Nov. 4, 2011, 6:44 a.m.
On Nov 3, 2011, at 2:09 PM, Wolfgang Denk wrote:

> Dear Wolfgang Denk,
> 
> In message <1319407132-6590-1-git-send-email-wd@denx.de> you wrote:
>> Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(),
>> strtoul" instroduced a build warning for some PPC systems:
>> 
>> board.c: In function 'board_init_r':
>> board.c:626: warning: unused variable 's'
>> 
>> Fix it.
>> 
>> Signed-off-by: Wolfgang Denk <wd@denx.de>
>> ---
>> arch/powerpc/lib/board.c |    5 +++--
>> 1 files changed, 3 insertions(+), 2 deletions(-)
> 
> Applied, thanks.
> 
> Best regards,
> 
> Wolfgang Denk

I'm still seeing this warning when building MPC8536DS_config

- k
Kumar Gala - Nov. 4, 2011, 6:47 a.m.
On Nov 4, 2011, at 1:44 AM, Kumar Gala wrote:

> 
> On Nov 3, 2011, at 2:09 PM, Wolfgang Denk wrote:
> 
>> Dear Wolfgang Denk,
>> 
>> In message <1319407132-6590-1-git-send-email-wd@denx.de> you wrote:
>>> Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(),
>>> strtoul" instroduced a build warning for some PPC systems:
>>> 
>>> board.c: In function 'board_init_r':
>>> board.c:626: warning: unused variable 's'
>>> 
>>> Fix it.
>>> 
>>> Signed-off-by: Wolfgang Denk <wd@denx.de>
>>> ---
>>> arch/powerpc/lib/board.c |    5 +++--
>>> 1 files changed, 3 insertions(+), 2 deletions(-)
>> 
>> Applied, thanks.
>> 
>> Best regards,
>> 
>> Wolfgang Denk
> 
> I'm still seeing this warning when building MPC8536DS_config
> 
> - k
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

I think we need to revert this now.

I don't see why you'd need it.

- k
Kim Phillips - Nov. 4, 2011, 3:41 p.m.
On Fri, 4 Nov 2011 01:47:04 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:

> On Nov 4, 2011, at 1:44 AM, Kumar Gala wrote:
> > On Nov 3, 2011, at 2:09 PM, Wolfgang Denk wrote:
> >> In message <1319407132-6590-1-git-send-email-wd@denx.de> you wrote:
> >>> Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(),
> >>> strtoul" instroduced a build warning for some PPC systems:
> >>> 
> >>> board.c: In function 'board_init_r':
> >>> board.c:626: warning: unused variable 's'
> >>> 
> >>> Fix it.
> >>> 
> >>> Signed-off-by: Wolfgang Denk <wd@denx.de>
> >>> ---
> >>> arch/powerpc/lib/board.c |    5 +++--
> >>> 1 files changed, 3 insertions(+), 2 deletions(-)
> >> 
> >> Applied, thanks.
> > 
> > I'm still seeing this warning when building MPC8536DS_config

me too, on most 83xx boards.

> I think we need to revert this now.
> 
> I don't see why you'd need it.

yes, all code fragments that utilize a variable 's' declare one local
to their code body.

Kim
Mike Frysinger - Nov. 4, 2011, 9:13 p.m.
On Friday 04 November 2011 02:47:04 Kumar Gala wrote:
> On Nov 4, 2011, at 1:44 AM, Kumar Gala wrote:
> > On Nov 3, 2011, at 2:09 PM, Wolfgang Denk wrote:
> >> Wolfgang Denk wrote:
> >>> Commit 1272592 "powerpc: Use getenv_ulong() in place of getenv(),
> >>> strtoul" instroduced a build warning for some PPC systems:
> >>> 
> >>> board.c: In function 'board_init_r':
> >>> board.c:626: warning: unused variable 's'
> >>> 
> >>> Fix it.
> >>> 
> >>> Signed-off-by: Wolfgang Denk <wd@denx.de>
> >>> ---
> >>> arch/powerpc/lib/board.c |    5 +++--
> >>> 1 files changed, 3 insertions(+), 2 deletions(-)
> >> 
> >> Applied, thanks.
> >> 
> >> Best regards,
> >> 
> >> Wolfgang Denk
> > 
> > I'm still seeing this warning when building MPC8536DS_config
> 
> I think we need to revert this now.

so post a revert of a9f4fc3fe571cc99260b063ad0ff291d31bafed0

> I don't see why you'd need it.

Wolfgang's patch was written before Simon's, but they both ended up getting 
merged when we only needed one of them ...
-mike

Patch

diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 6cb0ed6..aff1a0c 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -623,10 +623,11 @@  void board_init_f (ulong bootflag)
  */
 void board_init_r (gd_t *id, ulong dest_addr)
 {
-	char *s;
 	bd_t *bd;
 	ulong malloc_start;
-
+#if defined(CONFIG_SYS_FLASH_CHECKSUM) || defined(CONFIG_CMD_NET)
+	char *s;
+#endif
 #ifndef CONFIG_SYS_NO_FLASH
 	ulong flash_size;
 #endif