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.

Sponsored by:	Diablotin Systems
Reported by:	Mark Millard <marklmi@yahoo.com>
This commit is contained in:
Emmanuel Vadot 2021-07-05 15:50:39 +02:00
parent f649cff587
commit b464c459ea

View File

@ -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);