public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd_fdt.c: Use %p when printing pointers
@ 2012-10-30  0:53 Tom Rini
  2012-10-30  1:36 ` Joe Hershberger
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Tom Rini @ 2012-10-30  0:53 UTC (permalink / raw)
  To: u-boot

When putting pointers into a format string use %p to ensure that they
are printed correctly regardless of bitsize.  This fixes warnings on
sandbox on 64bit systems.

Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Gerald Van Baren <vanbaren@cideas.com>
Signed-off-by: Tom Rini <trini@ti.com>
---
 common/cmd_fdt.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index a5e2cfc..f9acfc1 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -375,7 +375,7 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 					/* Get address */
 					char buf[11];
 
-					sprintf(buf, "0x%08X", (uint32_t)nodep);
+					sprintf(buf, "0x%p", nodep);
 					setenv(var, buf);
 				} else if (subcmd[0] == 's') {
 					/* Get size */
@@ -816,7 +816,7 @@ static void print_data(const void *data, int len)
 
 	if ((len %4) == 0) {
 		if (len > CONFIG_CMD_FDT_MAX_DUMP)
-			printf("* 0x%08x [0x%08x]", (unsigned int)data, len);
+			printf("* 0x%p [0x%08x]", data, len);
 		else {
 			const u32 *p;
 
@@ -828,7 +828,7 @@ static void print_data(const void *data, int len)
 		}
 	} else { /* anything else... hexdump */
 		if (len > CONFIG_CMD_FDT_MAX_DUMP)
-			printf("* 0x%08x [0x%08x]", (unsigned int)data, len);
+			printf("* 0x%p [0x%08x]", data, len);
 		else {
 			const u8 *s;
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-11-04 18:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-30  0:53 [U-Boot] [PATCH] cmd_fdt.c: Use %p when printing pointers Tom Rini
2012-10-30  1:36 ` Joe Hershberger
2012-10-30  9:59 ` Wolfgang Denk
2012-10-30 17:48   ` Joe Hershberger
2012-10-30 19:04     ` Wolfgang Denk
     [not found]   ` <508FCBBA.1070200@cideas.com>
2012-10-30 18:10     ` Tom Rini
2012-10-30 19:19   ` [U-Boot] [PATCH] lib/vsprintf.c: don't special-case pointers to address null Wolfgang Denk
2012-10-30 19:23     ` Joe Hershberger
2012-11-04 18:28       ` Tom Rini
2012-11-04 18:28 ` [U-Boot] [PATCH] cmd_fdt.c: Use %p when printing pointers Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox