aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2021-07-05 13:50:39 +0000
committerKyle Evans <kevans@FreeBSD.org>2021-10-08 01:16:00 +0000
commit1748f0c6e1902a45f4148a2b2157a1f4dbdc7748 (patch)
treeacb371a651299f403edb418a5a4487d0f77a85e2
parent869ec7d90917e3f6c6c7829e0e47703a2a27c69e (diff)
downloadsrc-1748f0c6e1902a45f4148a2b2157a1f4dbdc7748.tar.gz
src-1748f0c6e1902a45f4148a2b2157a1f4dbdc7748.zip
loader: Fix dtb loading
When calling file_findfile with only a type it returns the first file matching the type. But in fdt_apply_overlays we then iterate on the next files and try loading them as dtb overlays. Fix this by checking the type one more time. Reported by: Mark Millard <marklmi@yahoo.com> (cherry picked from commit b464c459eaf4e63a3abaaa1ecf51c9d6e9f7521e)
-rw-r--r--stand/fdt/fdt_loader_cmd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/stand/fdt/fdt_loader_cmd.c b/stand/fdt/fdt_loader_cmd.c
index 7580eceedb05..c14b99768d70 100644
--- a/stand/fdt/fdt_loader_cmd.c
+++ b/stand/fdt/fdt_loader_cmd.c
@@ -466,6 +466,8 @@ fdt_apply_overlays()
current_fdtp_size = fdtp_size;
overlays_applied = 0;
for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) {
+ if (strcmp(fp->f_type, "dtbo") != 0)
+ continue;
COPYOUT(fp->f_addr, overlay, fp->f_size);
/* Check compatible first to avoid unnecessary allocation */
rv = fdt_check_overlay_compatible(current_fdtp, overlay);