All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] dm: ofnode: query correct property in livetree ofnode_get_addr_size
@ 2017-09-20 11:50 Klaus Goger
  2017-09-25  2:13 ` Simon Glass
  2017-09-29 21:00 ` sjg at google.com
  0 siblings, 2 replies; 3+ messages in thread
From: Klaus Goger @ 2017-09-20 11:50 UTC (permalink / raw)
  To: u-boot

The livetree codepath of ofnode_get_addr_size always used the "reg"
property for of_get_property. Use the property parameter of the function
call instead and check the return value if the property exists.
Otherwise return FDT_ADDR_T_NONE.

This was discoverd while using SPI NOR with livetree.
spi_flash_decode_fdt checks for memory-map and will not fail with
livetree even if the property does not exist.

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

---

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

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index c6ca13fabf..0030ab962e 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -468,8 +468,10 @@ fdt_addr_t ofnode_get_addr_size(ofnode node, const char *property,
 		int na, ns;
 		int psize;
 		const struct device_node *np = ofnode_to_np(node);
-		const __be32 *prop = of_get_property(np, "reg", &psize);
+		const __be32 *prop = of_get_property(np, property, &psize);
 
+		if (!prop)
+			return FDT_ADDR_T_NONE;
 		na = of_n_addr_cells(np);
 		ns = of_n_addr_cells(np);
 		*sizep = of_read_number(prop + na, ns);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] dm: ofnode: query correct property in livetree ofnode_get_addr_size
  2017-09-20 11:50 [U-Boot] [PATCH] dm: ofnode: query correct property in livetree ofnode_get_addr_size Klaus Goger
@ 2017-09-25  2:13 ` Simon Glass
  2017-09-29 21:00 ` sjg at google.com
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2017-09-25  2:13 UTC (permalink / raw)
  To: u-boot

On 20 September 2017 at 05:50, Klaus Goger
<klaus.goger@theobroma-systems.com> wrote:
> The livetree codepath of ofnode_get_addr_size always used the "reg"
> property for of_get_property. Use the property parameter of the function
> call instead and check the return value if the property exists.
> Otherwise return FDT_ADDR_T_NONE.
>
> This was discoverd while using SPI NOR with livetree.
> spi_flash_decode_fdt checks for memory-map and will not fail with
> livetree even if the property does not exist.
>
> Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> ---
>
>  drivers/core/ofnode.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] dm: ofnode: query correct property in livetree ofnode_get_addr_size
  2017-09-20 11:50 [U-Boot] [PATCH] dm: ofnode: query correct property in livetree ofnode_get_addr_size Klaus Goger
  2017-09-25  2:13 ` Simon Glass
@ 2017-09-29 21:00 ` sjg at google.com
  1 sibling, 0 replies; 3+ messages in thread
From: sjg at google.com @ 2017-09-29 21:00 UTC (permalink / raw)
  To: u-boot

On 20 September 2017 at 05:50, Klaus Goger
<klaus.goger@theobroma-systems.com> wrote:
> The livetree codepath of ofnode_get_addr_size always used the "reg"
> property for of_get_property. Use the property parameter of the function
> call instead and check the return value if the property exists.
> Otherwise return FDT_ADDR_T_NONE.
>
> This was discoverd while using SPI NOR with livetree.
> spi_flash_decode_fdt checks for memory-map and will not fail with
> livetree even if the property does not exist.
>
> Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> ---
>
>  drivers/core/ofnode.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-29 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-20 11:50 [U-Boot] [PATCH] dm: ofnode: query correct property in livetree ofnode_get_addr_size Klaus Goger
2017-09-25  2:13 ` Simon Glass
2017-09-29 21:00 ` sjg at google.com

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.