Instead of open-coding the comparison against the two magic UIMAGE_ constants, introduce a UIMAGE_IS_ADDRESS_VALID helper.
Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de> --- common/booti.c | 3 +-- include/bootm.h | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/booti.c b/common/booti.c index c8f6b5d4fc6d..40611b8f7228 100644 --- a/common/booti.c +++ b/common/booti.c @@ -15,8 +15,7 @@ static unsigned long get_kernel_address(unsigned long os_address, resource_size_t start, end; int ret; - if (os_address == UIMAGE_SOME_ADDRESS || - os_address == UIMAGE_INVALID_ADDRESS) { + if (!UIMAGE_IS_ADDRESS_VALID(os_address)) { ret = memory_bank_first_find_space(&start, &end); if (ret) return UIMAGE_INVALID_ADDRESS; diff --git a/include/bootm.h b/include/bootm.h index bc6c69e8134d..b35deb25bf8f 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -154,6 +154,9 @@ bool bootm_signed_images_are_forced(void); void bootm_force_signed_images(void); #define UIMAGE_SOME_ADDRESS (UIMAGE_INVALID_ADDRESS - 1) +#define UIMAGE_IS_ADDRESS_VALID(addr) \ + ((addr) != UIMAGE_INVALID_ADDRESS && \ + (addr) != UIMAGE_SOME_ADDRESS) void *booti_load_image(struct image_data *data, phys_addr_t *oftree); -- 2.39.5