pxe_utils: Simplify default fdt in label_run_boot()
authorSimon Glass <sjg@chromium.org>
Thu, 6 Mar 2025 00:25:13 +0000 (17:25 -0700)
committerTom Rini <trini@konsulko.com>
Tue, 18 Mar 2025 19:12:15 +0000 (13:12 -0600)
Tidy up this code a little to avoid two calls to env_get() for both
fdt_addr and fdtcontroladdr

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Quentin Schulz <quentin.schulz@cherry.de>
boot/pxe_utils.c

index bbb6ff2..37306f3 100644 (file)
@@ -612,24 +612,18 @@ static int label_run_boot(struct pxe_context *ctx, struct pxe_label *label,
        }
 
        if (!bmi.conf_fdt) {
-               if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) {
-                       if (strcmp("-", label->fdt))
-                               bmi.conf_fdt = env_get("fdt_addr");
-               } else {
+               if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
+                   strcmp("-", label->fdt))
                        bmi.conf_fdt = env_get("fdt_addr");
-               }
        }
 
        kernel_addr_r = genimg_get_kernel_addr(kernel_addr);
        buf = map_sysmem(kernel_addr_r, 0);
 
        if (!bmi.conf_fdt && genimg_get_format(buf) != IMAGE_FORMAT_FIT) {
-               if (IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS)) {
-                       if (strcmp("-", label->fdt))
-                               bmi.conf_fdt = env_get("fdtcontroladdr");
-               } else {
+               if (!IS_ENABLED(CONFIG_SUPPORT_PASSING_ATAGS) ||
+                   strcmp("-", label->fdt))
                        bmi.conf_fdt = env_get("fdtcontroladdr");
-               }
        }
 
        /* Try bootm for legacy and FIT format image */