Skip to contentSkip to conversation

dm: core: Correct address cast in dev_read_addr_ptr()

PATCH New Simon Glass 5 participants 8 messages Sep 28, 2017 – Nov 17, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm: core: Correct address cast in dev_read_addr_ptr()

This currently causes a warning in sandbox and will not do the right thing:

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;

Use map_sysmem() which is the correct way to convert an address to a pointer.

Fixes c131c8bca8 (dm: core: add dev_read_addr_ptr())

---

 drivers/core/read.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/core/read.c +2 -1
index eacf1716fd..5d440cee72 100644
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <mapmem.h>
 #include <dm/of_access.h>
 
 int dev_read_u32_default(struct udevice *dev, const char *propname, int def)
@@ -61,7 +62,7 @@ void *dev_read_addr_ptr(struct udevice *dev)
 {
 	fdt_addr_t addr = dev_read_addr(dev);
 
-	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
+	return (addr == FDT_ADDR_T_NONE) ? NULL : map_sysmem(addr, 0);
 }
 
 fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property,
Signature · 1 line
2.14.2.822.g60be5d43e6-goog
#1 lore raw

PATCH 1/1 dm: core: Correct address cast in dev_read_addr_ptr()

Quoted 11 lines · Simon Glass

This currently causes a warning in sandbox and will not do the right thing:

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;

Quoted 5 lines

Use map_sysmem() which is the correct way to convert an address to a pointer.

Fixes c131c8bca8 (dm: core: add dev_read_addr_ptr())
#2 lore raw

PATCH 1/1 dm: core: Correct address cast in dev_read_addr_ptr()

Simon,

Quoted 13 lines · Dr. Philipp Tomsich
Quoted 12 lines · Simon Glass

This currently causes a warning in sandbox and will not do the right thing:

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;

Quoted 7 lines
Quoted 5 lines

Use map_sysmem() which is the correct way to convert an address to a pointer.

Fixes c131c8bca8 (dm: core: add dev_read_addr_ptr())

I’ll pull this one in through u-boot-rockchip now, as Tom raised it as a build issue against my last pull-request.

Philipp.

#3 lore raw

PATCH 1/1 dm: core: Correct address cast in dev_read_addr_ptr()

Quoted 21 lines · Dr. Philipp Tomsich

Simon,

Quoted 19 lines · Dr. Philipp Tomsich
Quoted 17 lines · Simon Glass

This currently causes a warning in sandbox and will not do the right thing:

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;

Use map_sysmem() which is the correct way to convert an address to a pointer.

Fixes c131c8bca8 (dm: core: add dev_read_addr_ptr())
Quoted 7 lines
Quoted 1 line

I’ll pull this one in through u-boot-rockchip now, as Tom raised it as a build issue against my last pull-request.

Well, that's for the minor existing warning. The big problem is the build failures :)

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170930/2763bfb1/attachment.sig>
#4 lore raw

PATCH 1/1 dm: core: Correct address cast in dev_read_addr_ptr()

Quoted 28 lines · Tom Rini
Quoted 24 lines · Dr. Philipp Tomsich

Simon,

Quoted 20 lines · Dr. Philipp Tomsich
Quoted 12 lines · Simon Glass

This currently causes a warning in sandbox and will not do the right thing:

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;

Quoted 5 lines

Use map_sysmem() which is the correct way to convert an address to a pointer.

Fixes c131c8bca8 (dm: core: add dev_read_addr_ptr())
Quoted 7 lines
Quoted 4 lines

I’ll pull this one in through u-boot-rockchip now, as Tom raised it as a build issue against my last pull-request.

Well, that's for the minor existing warning. The big problem is the build failures :)

I already backed Jagan’s change to mach-tegra/cache.c out (missed that during my review and testing) and this is already running on Travis.

I understood you that I should also address those warnings related to the Rockchip code? If not, I’d rather have this one go through the -dm tree…

#5 lore raw

PATCH 1/1 dm: core: Correct address cast in dev_read_addr_ptr()

Quoted 36 lines · Dr. Philipp Tomsich
Quoted 28 lines · Tom Rini
Quoted 24 lines · Dr. Philipp Tomsich

Simon,

Quoted 20 lines · Dr. Philipp Tomsich
Quoted 12 lines · Simon Glass

This currently causes a warning in sandbox and will not do the right thing:

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;

Quoted 5 lines

Use map_sysmem() which is the correct way to convert an address to a pointer.

Fixes c131c8bca8 (dm: core: add dev_read_addr_ptr())
Quoted 7 lines
Quoted 4 lines

I’ll pull this one in through u-boot-rockchip now, as Tom raised it as a build issue against my last pull-request.

Well, that's for the minor existing warning. The big problem is the build failures :)

Quoted 6 lines

I already backed Jagan’s change to mach-tegra/cache.c out (missed that during my review and testing) and this is already running on Travis.

I understood you that I should also address those warnings related to the Rockchip code? If not, I’d rather have this one go through the -dm tree…

The DM warning fix can come via Simon's tree, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170930/71725dec/attachment.sig>
#6 lore raw

PATCH 1/1 dm: core: Correct address cast in dev_read_addr_ptr()

Quoted 36 lines · Dr. Philipp Tomsich
Quoted 28 lines · Tom Rini
Quoted 24 lines · Dr. Philipp Tomsich

Simon,

Quoted 20 lines · Dr. Philipp Tomsich
Quoted 12 lines · Simon Glass

This currently causes a warning in sandbox and will not do the right thing:

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;

Quoted 5 lines

Use map_sysmem() which is the correct way to convert an address to a pointer.

Fixes c131c8bca8 (dm: core: add dev_read_addr_ptr())
Quoted 7 lines
Quoted 4 lines

I’ll pull this one in through u-boot-rockchip now, as Tom raised it as a build issue against my last pull-request.

Well, that's for the minor existing warning. The big problem is the build failures :)

Quoted 6 lines

I already backed Jagan’s change to mach-tegra/cache.c out (missed that during my review and testing) and this is already running on Travis.

I understood you that I should also address those warnings related to the Rockchip code? If not, I’d rather have this one go through the -dm tree…

The DM warning fix can come via Simon's tree, thanks!

Signature · 3 lines
Tom

Applied to u-boot-dm thanks!
#7 lore raw

PATCH 1/1 dm: core: Correct address cast in dev_read_addr_ptr()

In reply to Simon Glass
Quoted 11 lines · Simon Glass

This currently causes a warning in sandbox and will not do the right thing:

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;

Use map_sysmem() which is the correct way to convert an address to a pointer.

Quoted 7 lines
Fixes c131c8bca8 (dm: core: add dev_read_addr_ptr())

---

 drivers/core/read.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)