libfdt: overlay_rename_fragments: handle no fragments in base dtb
In case where base dtbo has no fragments, count_fragments returns
-FDT_ERR_NOTFOUND. In this case, there is no need to rename fragments in
the merged dtbo.
Change-Id: Id21c5a4c582b5b16059dae5c954c451a29a49240
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c
index a5ece6d..2879b04 100644
--- a/libfdt/fdt_overlay.c
+++ b/libfdt/fdt_overlay.c
@@ -1405,7 +1405,6 @@
offset = fdt_next_subnode(fdt, offset);
}
-
if (!found)
return -FDT_ERR_NOTFOUND;
@@ -1428,7 +1427,10 @@
unsigned long max_base_fragments = 0;
ret = count_fragments(fdt, &max_base_fragments);
- if (ret < 0)
+ /* no fragments in base dtb? then nothing to rename */
+ if (ret == -FDT_ERR_NOTFOUND)
+ return 0;
+ else if (ret < 0)
return ret;
max_base_fragments += 1;