[U-Boot] [PATCH] dfu: fix 64-bit compile warnings

Stephen Warren swarren at wwwdotorg.org
Wed Jul 22 22:54:04 CEST 2015


From: Stephen Warren <swarren at nvidia.com>

Use %p to print pointers.

The max value of (i_buf - i_buf_start) should be dfu_buf_size, which is
an unsigned long, so cast the pointer difference to that type to print.

Change-Id: Iee242df9f8eb091aecfe0cea4c282b28b547acfe
Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
 drivers/dfu/dfu.c     | 4 ++--
 drivers/dfu/dfu_mmc.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 0560afa9ffa5..675162d927d8 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -198,9 +198,9 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
 {
 	int ret;
 
-	debug("%s: name: %s buf: 0x%p size: 0x%x p_num: 0x%x offset: 0x%llx bufoffset: 0x%x\n",
+	debug("%s: name: %s buf: 0x%p size: 0x%x p_num: 0x%x offset: 0x%llx bufoffset: 0x%lx\n",
 	      __func__, dfu->name, buf, size, blk_seq_num, dfu->offset,
-	      dfu->i_buf - dfu->i_buf_start);
+	      (unsigned long)(dfu->i_buf - dfu->i_buf_start));
 
 	if (!dfu->inited) {
 		/* initial state */
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index fd865e11212e..2a780f7b5d31 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -156,7 +156,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
 		dfu->data.mmc.dev, dfu->data.mmc.part);
 
 	if (op != DFU_OP_SIZE)
-		sprintf(cmd_buf + strlen(cmd_buf), " 0x%x", (unsigned int)buf);
+		sprintf(cmd_buf + strlen(cmd_buf), " %p", buf);
 
 	sprintf(cmd_buf + strlen(cmd_buf), " %s", dfu->name);
 
-- 
1.9.1



More information about the U-Boot mailing list