[U-Boot] drivers/core/read.c:64:44: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Hello Simon,
sandbox_defconfig has
arch/sandbox/include/asm/types.h:60: typedef u32 phys_addr_t;
even if building on a 64bit machine.
This results in a warning
CC drivers/demo/demo-uclass.o drivers/core/read.c: In function ‘dev_read_addr_ptr’: drivers/core/read.c:64:44: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
Why don't we set phys_addr_t according to the host architecture?
Regards
Heinrich

+Bin
Hi Heinrich,
On 21 September 2017 at 05:11, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
sandbox_defconfig has
arch/sandbox/include/asm/types.h:60: typedef u32 phys_addr_t;
even if building on a 64bit machine.
This results in a warning
CC drivers/demo/demo-uclass.o drivers/core/read.c: In function ‘dev_read_addr_ptr’: drivers/core/read.c:64:44: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
Why don't we set phys_addr_t according to the host architecture?
This is because sandbox uses 32-bit address internally, at least that was my intention. The sandbox architecture does not mirror its host, but tries to define it own memory model.
This above line should use map_sysmem() to convert the address to a pointer.
Regards, Simon

Hi,
On 24 September 2017 at 20:14, Simon Glass sjg@chromium.org wrote:
+Bin
Hi Heinrich,
On 21 September 2017 at 05:11, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
sandbox_defconfig has
arch/sandbox/include/asm/types.h:60: typedef u32 phys_addr_t;
even if building on a 64bit machine.
This results in a warning
CC drivers/demo/demo-uclass.o drivers/core/read.c: In function ‘dev_read_addr_ptr’: drivers/core/read.c:64:44: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
Why don't we set phys_addr_t according to the host architecture?
This is because sandbox uses 32-bit address internally, at least that was my intention. The sandbox architecture does not mirror its host, but tries to define it own memory model.
This above line should use map_sysmem() to convert the address to a pointer.
I sent:
http://patchwork.ozlabs.org/patch/819567/
Regards, Simon
participants (2)
-
Heinrich Schuchardt
-
Simon Glass