]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
bootm: Drop #ifdef in bootm_find_images()
authorSimon Glass <sjg@chromium.org>
Sat, 18 Nov 2023 21:05:08 +0000 (14:05 -0700)
committerTom Rini <trini@konsulko.com>
Wed, 13 Dec 2023 16:51:24 +0000 (11:51 -0500)
The OF_LIBFDT #ifdef makes it harder to use a local variable for that
code block. Convert it to if() instead.

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

index d5893e82d128d2363014da9540e0432984fb907a..d9c62d730f7fd98e80484416fc636eb57f196376 100644 (file)
@@ -524,29 +524,29 @@ int bootm_find_images(int flag, int argc, char *const argv[], ulong start,
                return 1;
        }
 
-#if CONFIG_IS_ENABLED(OF_LIBFDT)
-       /* find flattened device tree */
-       ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images,
-                          &images.ft_addr, &images.ft_len);
-       if (ret) {
-               puts("Could not find a valid device tree\n");
-               return 1;
-       }
+       if (CONFIG_IS_ENABLED(OF_LIBFDT)) {
+               /* find flattened device tree */
+               ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images,
+                                  &images.ft_addr, &images.ft_len);
+               if (ret) {
+                       puts("Could not find a valid device tree\n");
+                       return 1;
+               }
 
-       /* check if FDT overlaps OS image */
-       if (images.ft_addr &&
-           (((ulong)images.ft_addr >= start &&
-             (ulong)images.ft_addr < start + size) ||
-            ((ulong)images.ft_addr + images.ft_len >= start &&
-             (ulong)images.ft_addr + images.ft_len < start + size))) {
-               printf("ERROR: FDT image overlaps OS image (OS=0x%lx..0x%lx)\n",
-                      start, start + size);
-               return 1;
-       }
+               /* check if FDT overlaps OS image */
+               if (images.ft_addr &&
+                   (((ulong)images.ft_addr >= start &&
+                     (ulong)images.ft_addr < start + size) ||
+                    ((ulong)images.ft_addr + images.ft_len >= start &&
+                     (ulong)images.ft_addr + images.ft_len < start + size))) {
+                       printf("ERROR: FDT image overlaps OS image (OS=0x%lx..0x%lx)\n",
+                              start, start + size);
+                       return 1;
+               }
 
-       if (IS_ENABLED(CONFIG_CMD_FDT))
-               set_working_fdt_addr(map_to_sysmem(images.ft_addr));
-#endif
+               if (IS_ENABLED(CONFIG_CMD_FDT))
+                       set_working_fdt_addr(map_to_sysmem(images.ft_addr));
+       }
 
 #if CONFIG_IS_ENABLED(FIT)
        if (IS_ENABLED(CONFIG_FPGA)) {