summaryrefslogtreecommitdiff
path: root/src/base/loader
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2015-11-06 03:26:16 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2015-11-06 03:26:16 -0500
commit2cb5467e8514934c4d88304c65050adead0ffc7e (patch)
tree693dc8a9aa6fdadb2d1856bece4510e30527c256 /src/base/loader
parent3747e178ed11ef0d73a50443bc9dc5498a91b1c9 (diff)
downloadgem5-2cb5467e8514934c4d88304c65050adead0ffc7e.tar.xz
misc: Appease clang static analyzer
A few minor fixes to issues identified by the clang static analyzer.
Diffstat (limited to 'src/base/loader')
-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);