[U-Boot] [PATCH 03/13] dfu: Build warning fixes for 64-bit

Thierry Reding thierry.reding at gmail.com
Fri Mar 20 12:41:18 CET 2015


From: Thierry Reding <treding at nvidia.com>

Explicitly cast the result of a pointer arithmetic to unsigned int so
that it matches the corresponding printf format string. While at it, use
%p to print a buffer address rather than %x and an explicit cast (which
causes a warning in this case because it's cast to unsigned int instead
of unsigned long).

Cc: Łukasz Majewski <l.majewski at samsung.com>
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
 drivers/dfu/dfu.c     | 2 +-
 drivers/dfu/dfu_mmc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 0560afa9ffa5..5c137acfaa04 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -200,7 +200,7 @@ int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
 
 	debug("%s: name: %s buf: 0x%p size: 0x%x p_num: 0x%x offset: 0x%llx bufoffset: 0x%x\n",
 	      __func__, dfu->name, buf, size, blk_seq_num, dfu->offset,
-	      dfu->i_buf - dfu->i_buf_start);
+	      (unsigned int)(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);
 
-- 
2.3.2



More information about the U-Boot mailing list