summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Goger <klaus.goger@theobroma-systems.com>2017-09-20 13:50:41 +0200
committerKlaus Goger <klaus.goger@theobroma-systems.com>2017-10-27 09:21:30 +0200
commitd7c7ea3b4251de8a98a4ae0d749512d2042cc565 (patch)
tree169adee85ee9938968c3c7c51fc3b8a3843294da
parenta308e784ba821461a4b5131207074ca33701e0d9 (diff)
dm: ofnode: query correct property in livetree ofnode_get_addr_size
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> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--drivers/core/ofnode.c4
1 files changed, 3 insertions, 1 deletions
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);