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

Lukasz Majewski l.majewski at samsung.com
Mon Mar 23 11:06:49 CET 2015


Hi Thierry,

> 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);
>  

Acked-by: Lukasz Majewski <l.majewski at samsung.com>
Tested-by: Lukasz Majewski <l.majewski at samsung.com>
[test HW: trats - Exynos4210 board]

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list