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

Haavard Skinnemoen haavard.skinnemoen at atmel.com
Wed Jul 30 10:35:53 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 added a cast to unsigned long. This
should be safe even if bi_baudrate is declared as 'int' (assuming
there's no such thing as negative baud rates.)

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen at atmel.com>
---
 common/cmd_bdinfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 24ff9b9..57c673c 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", (unsigned long)bd->bi_baudrate);
 
 	return 0;
 }
-- 
1.5.6.2





More information about the U-Boot mailing list