]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
bootstd: Tweak bootflow logic for device tree
authorSimon Glass <sjg@chromium.org>
Mon, 24 Apr 2023 01:49:44 +0000 (13:49 +1200)
committerTom Rini <trini@konsulko.com>
Wed, 26 Apr 2023 12:43:04 +0000 (08:43 -0400)
We should only store the FDT filename if we were able to determine one.
Adjust the logic for this.

This corrects the case where no FDT is needed to boot, such as with EFI
using ACPI.

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/bootmeth_efi.c

index 6a97ac02ff5ccc1fb60bafca254388d3f322bf34..d7e042cf01ee8c9a7520d166375061271d7c00bc 100644 (file)
@@ -235,21 +235,21 @@ static int distro_efi_read_bootflow_file(struct udevice *dev,
 
        /* try the various available names */
        ret = -ENOENT;
-       for (seq = 0; ret; seq++) {
+       *fname = '\0';
+       for (seq = 0; ret == -ENOENT; seq++) {
                ret = distro_efi_get_fdt_name(fname, sizeof(fname), seq);
-               if (ret == -EALREADY) {
+               if (ret == -EALREADY)
                        bflow->flags = BOOTFLOWF_USE_PRIOR_FDT;
-                       break;
-               }
-               if (ret)
-                       return log_msg_ret("nam", ret);
-               ret = bootmeth_common_read_file(dev, bflow, fname, fdt_addr,
-                                               &size);
+               if (!ret)
+                       ret = bootmeth_common_read_file(dev, bflow, fname,
+                                                       fdt_addr, &size);
        }
 
-       bflow->fdt_fname = strdup(fname);
-       if (!bflow->fdt_fname)
-               return log_msg_ret("fil", -ENOMEM);
+       if (*fname) {
+               bflow->fdt_fname = strdup(fname);
+               if (!bflow->fdt_fname)
+                       return log_msg_ret("fil", -ENOMEM);
+       }
 
        if (!ret) {
                bflow->fdt_size = size;