From 2cb5467e8514934c4d88304c65050adead0ffc7e Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 6 Nov 2015 03:26:16 -0500 Subject: misc: Appease clang static analyzer A few minor fixes to issues identified by the clang static analyzer. --- src/base/loader/dtb_object.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/base') 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); -- cgit v1.2.3