diff options
Diffstat (limited to 'softmmu/device_tree.c')
| -rw-r--r-- | softmmu/device_tree.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c index 3965c834ca..6ca3fad285 100644 --- a/softmmu/device_tree.c +++ b/softmmu/device_tree.c @@ -60,7 +60,8 @@ void *create_device_tree(int *sizep) } ret = fdt_open_into(fdt, fdt, *sizep); if (ret) { - error_report("Unable to copy device tree in memory"); + error_report("%s: Unable to copy device tree into memory: %s", + __func__, fdt_strerror(ret)); exit(1); } @@ -104,7 +105,8 @@ void *load_device_tree(const char *filename_path, int *sizep) ret = fdt_open_into(fdt, fdt, dt_size); if (ret) { - error_report("Unable to copy device tree in memory"); + error_report("%s: Unable to copy device tree into memory: %s", + __func__, fdt_strerror(ret)); goto fail; } @@ -556,7 +558,6 @@ int qemu_fdt_add_subnode(void *fdt, const char *name) int qemu_fdt_add_path(void *fdt, const char *path) { const char *name; - const char *p = path; int namelen, retval; int parent = 0; @@ -564,10 +565,10 @@ int qemu_fdt_add_path(void *fdt, const char *path) return -1; } - while (p) { - name = p + 1; - p = strchr(name, '/'); - namelen = p != NULL ? p - name : strlen(name); + do { + name = path + 1; + path = strchr(name, '/'); + namelen = path != NULL ? path - name : strlen(name); retval = fdt_subnode_offset_namelen(fdt, parent, name, namelen); if (retval < 0 && retval != -FDT_ERR_NOTFOUND) { @@ -584,7 +585,7 @@ int qemu_fdt_add_path(void *fdt, const char *path) } parent = retval; - } + } while (path); return retval; } |