[U-Boot-Users] [PATCH v2] cmd_bdinfo: Fix printf() format warning

Haavard Skinnemoen haavard.skinnemoen at atmel.com
Wed Jul 30 13:26:56 CEST 2008


Fix the following warning on avr32 and, from the looks of it, all other
architectures except arm, blackfin and mips.

cmd_bdinfo.c: In function 'do_bdinfo':
cmd_bdinfo.c:367: warning: format '%d' expects type 'int', but argument
2 has type 'long unsigned int'

In order to not introduce new warnings on the aforementioned three
architectures as well as i386, I changed the type of the bi_baudrate
field to be unsigned long so that all architectures are consisten. This
may break some really questionable code (highly unlikely) and/or
introduce new format warnings elsewhere (somewhat more likely), but if
so, it needs fixing anyway.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen at atmel.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj at jcrosoft.com>
Cc: Mike Frysinger <vapier at gentoo.org>
Cc: Shinya Kuribayashi <skuribay at ruby.dti.ne.jp>
---
Cc'ed the maintainers of the affected architectures except i386.

Does anyone know who's in charge of the i386 port? The chances of
breakage on i386 is lower than on the other three architectures since
the field is unsigned to begin with, and is wedged between two other
unsigned longs, so it shouldn't cause any changes to the struct layout
even on x86_64.

 common/cmd_bdinfo.c           |    2 +-
 include/asm-arm/u-boot.h      |    2 +-
 include/asm-blackfin/u-boot.h |    2 +-
 include/asm-i386/u-boot.h     |    2 +-
 include/asm-mips/u-boot.h     |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 24ff9b9..b38f43c 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -364,7 +364,7 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	}
 	puts ("\nip_addr     = ");
 	print_IPaddr (bd->bi_ip_addr);
-	printf ("\nbaudrate    = %d bps\n", bd->bi_baudrate);
+	printf ("\nbaudrate    = %lu bps\n", bd->bi_baudrate);
 
 	return 0;
 }
diff --git a/include/asm-arm/u-boot.h b/include/asm-arm/u-boot.h
index b11d555..8c739ff 100644
--- a/include/asm-arm/u-boot.h
+++ b/include/asm-arm/u-boot.h
@@ -37,7 +37,7 @@
 #define _U_BOOT_H_	1
 
 typedef struct bd_info {
-    int			bi_baudrate;	/* serial console baudrate */
+    unsigned long	bi_baudrate;	/* serial console baudrate */
     unsigned long	bi_ip_addr;	/* IP Address */
     unsigned char	bi_enetaddr[6]; /* Ethernet adress */
     struct environment_s	       *bi_env;
diff --git a/include/asm-blackfin/u-boot.h b/include/asm-blackfin/u-boot.h
index 9d2903b..a3907ec 100644
--- a/include/asm-blackfin/u-boot.h
+++ b/include/asm-blackfin/u-boot.h
@@ -29,7 +29,7 @@
 #define _U_BOOT_H_	1
 
 typedef struct bd_info {
-	int bi_baudrate;		/* serial console baudrate */
+	unsigned long bi_baudrate;	/* serial console baudrate */
 	unsigned long bi_ip_addr;	/* IP Address */
 	unsigned char bi_enetaddr[6];	/* Ethernet adress */
 	unsigned long bi_boot_params;	/* where this board expects params */
diff --git a/include/asm-i386/u-boot.h b/include/asm-i386/u-boot.h
index fc5a2ae..1276e39 100644
--- a/include/asm-i386/u-boot.h
+++ b/include/asm-i386/u-boot.h
@@ -50,7 +50,7 @@ typedef struct bd_info {
 	unsigned short	bi_ethspeed;	/* Ethernet speed in Mbps */
 	unsigned long	bi_intfreq;	/* Internal Freq, in MHz */
 	unsigned long	bi_busfreq;	/* Bus Freq, in MHz */
-	unsigned int	bi_baudrate;	/* Console Baudrate */
+	unsigned long	bi_baudrate;	/* Console Baudrate */
 	unsigned long   bi_boot_params;	/* where this board expects params */
 	struct environment_s	       *bi_env;
 	struct				/* RAM configuration */
diff --git a/include/asm-mips/u-boot.h b/include/asm-mips/u-boot.h
index 9ecb9ac..c40afd7 100644
--- a/include/asm-mips/u-boot.h
+++ b/include/asm-mips/u-boot.h
@@ -32,7 +32,7 @@
 #define _U_BOOT_H_	1
 
 typedef struct bd_info {
-	int		bi_baudrate;	/* serial console baudrate */
+	unsigned long	bi_baudrate;	/* serial console baudrate */
 	unsigned long	bi_ip_addr;	/* IP Address */
 	unsigned char	bi_enetaddr[6];	/* Ethernet adress */
 	unsigned long	bi_arch_number;	/* unique id for this board */
-- 
1.5.6.3





More information about the U-Boot mailing list