summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/loader/dtb_object.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/base/loader/dtb_object.cc b/src/base/loader/dtb_object.cc
index 841db8c12..ead667f11 100644
--- a/src/base/loader/dtb_object.cc
+++ b/src/base/loader/dtb_object.cc
@@ -109,7 +109,10 @@ DtbObject::addBootCmdLine(const char* _args, size_t len)
// try adding the node by walking dtb tree to proper insertion point
offset = fdt_path_offset((void*)fdt_buf_w_space, root_path);
offset = fdt_add_subnode((void*)fdt_buf_w_space, offset, node_name);
- offset = fdt_path_offset((void*)fdt_buf_w_space, full_path_node_name);
+ // if we successfully add the subnode, get the offset
+ if (offset >= 0)
+ offset = fdt_path_offset((void*)fdt_buf_w_space, full_path_node_name);
+
if (offset < 0) {
warn("Error finding or adding \"chosen\" subnode to flattened "
"device tree, errno: %d\n", offset);