diff mbox

[U-Boot,v4,02/16] sandbox: Correct data sizes and printf() strings in fdtdec.c

Message ID 1382135604-31828-3-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass Oct. 18, 2013, 10:33 p.m. UTC
There are a few warnings in this file when building for sandbox. Addresses
coming from the device tree need to be treated as ulong as elsewhere in
U-Boot and we must use map_sysmem() to convert to a pointer when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v4: None
Changes in v3: None
Changes in v2: None

 lib/fdtdec.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Marek Vasut Oct. 20, 2013, 5:06 a.m. UTC | #1
Dear Simon Glass,

> There are a few warnings in this file when building for sandbox. Addresses
> coming from the device tree need to be treated as ulong as elsewhere in
> U-Boot and we must use map_sysmem() to convert to a pointer when needed.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Marek Vasut <marex@denx.de>

> ---
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
>  lib/fdtdec.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index dc35856..692bcc6 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -84,10 +84,10 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int
> node, size = (fdt_size_t *)((char *)cell +
>  					sizeof(fdt_addr_t));
>  			*sizep = fdt_size_to_cpu(*size);
> -			debug("addr=%p, size=%p\n", (void *)addr,
> -			      (void *)*sizep);
> +			debug("addr=%08lx, size=%08x\n",
> +			      (ulong)addr, *sizep);
>  		} else {
> -			debug("%p\n", (void *)addr);
> +			debug("%08lx\n", (ulong)addr);
>  		}
>  		return addr;
>  	}
> @@ -609,7 +609,7 @@ int fdtdec_decode_region(const void *blob, int node,
>  	if (!cell || (len != sizeof(fdt_addr_t) * 2))
>  		return -1;
> 
> -	*ptrp = (void *)fdt_addr_to_cpu(*cell);
> +	*ptrp = map_sysmem(fdt_addr_to_cpu(*cell), *size);
>  	*size = fdt_size_to_cpu(cell[1]);
>  	debug("%s: size=%zx\n", __func__, *size);
>  	return 0;

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index dc35856..692bcc6 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -84,10 +84,10 @@  fdt_addr_t fdtdec_get_addr_size(const void *blob, int node,
 			size = (fdt_size_t *)((char *)cell +
 					sizeof(fdt_addr_t));
 			*sizep = fdt_size_to_cpu(*size);
-			debug("addr=%p, size=%p\n", (void *)addr,
-			      (void *)*sizep);
+			debug("addr=%08lx, size=%08x\n",
+			      (ulong)addr, *sizep);
 		} else {
-			debug("%p\n", (void *)addr);
+			debug("%08lx\n", (ulong)addr);
 		}
 		return addr;
 	}
@@ -609,7 +609,7 @@  int fdtdec_decode_region(const void *blob, int node,
 	if (!cell || (len != sizeof(fdt_addr_t) * 2))
 		return -1;
 
-	*ptrp = (void *)fdt_addr_to_cpu(*cell);
+	*ptrp = map_sysmem(fdt_addr_to_cpu(*cell), *size);
 	*size = fdt_size_to_cpu(cell[1]);
 	debug("%s: size=%zx\n", __func__, *size);
 	return 0;