summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Elliot Berman <eberman@codeaurora.org> 2020-12-21 12:48:01 -0800
committer Michael Bestas <mkbestas@lineageos.org> 2025-06-15 18:57:38 +0300
commitfcee4a432d79c473809df5db683be2b2df8e8589 (patch)
treee485ba9c9a3eb3d7711f9f744676bc332bbe4c10
parent834bb50528c8bd96c7a379182e449c1b33a232d2 (diff)
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>
-rw-r--r--libfdt/fdt_overlay.c6
1 files changed, 4 insertions, 2 deletions
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 @@ next_node:
offset = fdt_next_subnode(fdt, offset);
}
-
if (!found)
return -FDT_ERR_NOTFOUND;
@@ -1428,7 +1427,10 @@ static int overlay_rename_fragments(void *fdt, void *fdto)
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;