Skip to contentSkip to conversation

powerpc: Correct build warning introduced by getenv_ulong() patch

PATCH Superseded Simon Glass 3 participants 4 messages Oct 24, 2011 – Nov 5, 2011 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Correct build warning introduced by getenv_ulong() patch

Commit 1272592 introduced a warning since the variable 's' is no longer always used, depending on the CONFIG options.

---
 arch/powerpc/lib/board.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
arch/powerpc/lib/board.c +7 -3
index 6cb0ed6..508075f 100644
@@ -623,7 +623,6 @@ void board_init_f (ulong bootflag)
  */
 void board_init_r (gd_t *id, ulong dest_addr)
 {
-	char *s;
 	bd_t *bd;
 	ulong malloc_start;
 
@@ -727,6 +726,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
 		flash_size = 0;
 	} else if ((flash_size = flash_init ()) > 0) {
 # ifdef CONFIG_SYS_FLASH_CHECKSUM
+		char *s;
+
 		print_size (flash_size, "");
 		/*
 		 * Compute and print flash CRC if flashchecksum is set to 'y'
@@ -927,8 +928,11 @@ 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)
-	if ((s = getenv ("bootfile")) != NULL) {
-		copy_filename (BootFile, s, sizeof (BootFile));
+	{
+		char *s = getenv("bootfile");
+
+		if (s != NULL)
+			copy_filename(BootFile, s, sizeof(BootFile));
 	}
 #endif
 
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 1/1 powerpc: Correct build warning introduced by getenv_ulong() patch

Dear Simon Glass,

Quoted 7 lines · In message <[email protected]> you wrote:

Commit 1272592 introduced a warning since the variable 's' is no longer always used, depending on the CONFIG options.

---
 arch/powerpc/lib/board.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Buy land. They've stopped making it."                   - Mark Twain
#2 lore raw

PATCH 1/1 powerpc: Correct build warning introduced by getenv_ulong() patch

In reply to Simon Glass
Quoted 22 lines · On Sunday 23 October 2011 23:41:54 Simon Glass wrote:
arch/powerpc/lib/board.c +2 -1
 
  */
 void board_init_r (gd_t *id, ulong dest_addr)
 {
-	char *s;
 	bd_t *bd;
 	ulong malloc_start;
@@ -727,6 +726,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
 		flash_size = 0;
 	} else if ((flash_size = flash_init ()) > 0) {
 # ifdef CONFIG_SYS_FLASH_CHECKSUM
+		char *s;
+
 		print_size (flash_size, "");
 		/*
 		 * Compute and print flash CRC if flashchecksum is set to 'y'
@@ -927,8 +928,11 @@ void board_init_r (gd_t *id, ulong dest_addr)
 	/* Initialize from environment */
 	load_addr = getenv_ulong("loadaddr", 16, load_addr);

arch/powerpc/lib/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 937

Quoted 10 lines
arch/powerpc/lib/board.c +5 -2
 #if defined(CONFIG_CMD_NET)
-	if ((s = getenv ("bootfile")) != NULL) {
-		copy_filename (BootFile, s, sizeof (BootFile));
+	{
+		char *s = getenv("bootfile");
+
+		if (s != NULL)
+			copy_filename(BootFile, s, sizeof(BootFile));
 	}
 #endif

same feedback here wrt using __maybe_unused and marking things const ... -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111030/1ec12b89/attachment.pgp

#3 lore raw

PATCH 1/1 powerpc: Correct build warning introduced by getenv_ulong() patch

Hi Mike,

Quoted 28 lines · Mike Frysinger
Quoted 27 lines · On Sunday 23 October 2011 23:41:54 Simon Glass wrote:
arch/powerpc/lib/board.c +0 -0

? */
?void board_init_r (gd_t *id, ulong dest_addr)
?{
- ? ? char *s;
? ? ? bd_t *bd;
? ? ? ulong malloc_start;

arch/powerpc/lib/board.c +0 -0
@@ -727,6 +726,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
 ? ? ? ? ? ? ? flash_size = 0;
 ? ? ? } else if ((flash_size = flash_init ()) > 0) {

?# ifdef CONFIG_SYS_FLASH_CHECKSUM
+ ? ? ? ? ? ? char *s;
+
? ? ? ? ? ? ? print_size (flash_size, "");
? ? ? ? ? ? ? /*
? ? ? ? ? ? ? ?* Compute and print flash CRC if flashchecksum is set to 'y'

arch/powerpc/lib/board.c +0 -0
@@ -927,8 +928,11 @@ 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)
- ? ? if ((s = getenv ("bootfile")) != NULL) {
- ? ? ? ? ? ? copy_filename (BootFile, s, sizeof (BootFile));
+ ? ? {
+ ? ? ? ? ? ? char *s = getenv("bootfile");

Quoted 9 lines
Quoted 5 lines

+
+ ? ? ? ? ? ? if (s != NULL)
+ ? ? ? ? ? ? ? ? ? ? copy_filename(BootFile, s, sizeof(BootFile)); ? ? ? }
?#endif

same feedback here wrt using __maybe_unused and marking things const ... -mike

I might leave that alone for now, at least until I get back to the board.c side of things. It was just a warning fix, and I feel that board_init_r() is too long and should not do so many things.

Regards,
Simon