summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2017-10-20 12:08:14 +1100
committerAlistair Popple <alistair@popple.id.au>2017-10-20 12:11:38 +1100
commit63cc8da7067c1160e891a131cec72b19f40c10ac (patch)
tree64cb0fdfee2718f1d95bb8c2165c53528cd98d8e
parent77158819158d1d7053a737ac090d04fdfbfe9265 (diff)
downloadpdbg-63cc8da7067c1160e891a131cec72b19f40c10ac.tar.gz
pdbg-63cc8da7067c1160e891a131cec72b19f40c10ac.zip
libpdbg/device.c: Remove usage of libfdt internal functions
The code in device.c was largely based on code from Skiboot which included calls to _fdt_check_node_offset and _fdt_offset_ptr which are internal libfdt functions. This makes packaging difficult so remove the usage of these functions and call the correct public library API equivalents. Signed-off-by: Alistair Popple <alistair@popple.id.au> Suggested-by: Frédéric Bonnard <frederic@fr.ibm.com>
-rw-r--r--libpdbg/device.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libpdbg/device.c b/libpdbg/device.c
index dbbe42f..e7b8ee0 100644
--- a/libpdbg/device.c
+++ b/libpdbg/device.c
@@ -786,19 +786,20 @@ int dt_expand_node(struct dt_node *node, const void *fdt, int fdt_node)
uint32_t tag;
if (((err = fdt_check_header(fdt)) != 0)
- || ((err = _fdt_check_node_offset(fdt, fdt_node)) < 0)) {
+ || (fdt_node < 0) || (fdt_node % FDT_TAGSIZE)
+ || (fdt_next_tag(fdt, fdt_node, &fdt_node) != FDT_BEGIN_NODE)) {
prerror("FDT: Error %d parsing node 0x%x\n", err, fdt_node);
return -1;
}
- nextoffset = err;
+ nextoffset = fdt_node;
do {
offset = nextoffset;
tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_PROP:
- prop = _fdt_offset_ptr(fdt, offset);
+ prop = fdt_offset_ptr(fdt, offset, 0);
name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));
dt_add_property(node, name, prop->data,
fdt32_to_cpu(prop->len));
OpenPOWER on IntegriCloud