[PATCH 19/29] bootm: Drop #ifdef in bootm_find_images()
Simon Glass
sjg at chromium.org
Sun Nov 12 01:09:04 CET 2023
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 at chromium.org>
---
boot/bootm.c | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/boot/bootm.c b/boot/bootm.c
index 5782a1e2a57b..0de49a9d1fa1 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -523,29 +523,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)) {
--
2.42.0.869.gea05f2083d-goog
More information about the U-Boot
mailing list