summaryrefslogtreecommitdiff
path: root/common/fdt_support.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-07-04 13:31:20 -0600
committerJaehoon Chung <jh80.chung@samsung.com>2017-08-01 11:58:00 +0900
commit336a44877af84fc65e58a0759d9dc199e8c97036 (patch)
tree71816afa953a4aff86ba66589e19cad6ce284ca7 /common/fdt_support.c
parentc4d660d4d0abcde0fdbcee8401b215fc2b56d7aa (diff)
fdt: Correct fdt_get_base_address()
This function appears to obtain the value of the 'ranges' property rather than 'reg'. As such it does not behave as documented or expected. In addition it picks up the second field of the property which is the size (with prop += naddr) rather than the first which is the address. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/fdt_support.c')
-rw-r--r--common/fdt_support.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 5aa8e3422e..7ccf8b19fd 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1464,14 +1464,11 @@ int fdt_verify_alias_address(void *fdt, int anode, const char *alias, u64 addr)
u64 fdt_get_base_address(const void *fdt, int node)
{
int size;
- u32 naddr;
const fdt32_t *prop;
- naddr = fdt_address_cells(fdt, node);
+ prop = fdt_getprop(fdt, node, "reg", &size);
- prop = fdt_getprop(fdt, node, "ranges", &size);
-
- return prop ? fdt_translate_address(fdt, node, prop + naddr) : 0;
+ return prop ? fdt_translate_address(fdt, node, prop) : 0;
}
/*