mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/7] bootm: implement UIMAGE_IS_ADDRESS_VALID helper
Date: Wed,  9 Apr 2025 16:01:31 +0200	[thread overview]
Message-ID: <20250409140134.2079552-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250409140134.2079552-1-a.fatoum@pengutronix.de>

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.fatoum@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




  parent reply	other threads:[~2025-04-09 14:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 14:01 [PATCH 0/7] ARM: add support for chainloading barebox inside FIP images Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 1/7] fip: add struct fip_image_desc::private_data Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 2/7] fip: mark predefined toc_entries array const Ahmad Fatoum
2025-04-09 14:01 ` Ahmad Fatoum [this message]
2025-04-09 14:01 ` [PATCH 4/7] ARM: legacy: make architecture number unsigned Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 5/7] ARM: introduce jump_to_linux helper Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 6/7] ARM: add support for chainloading barebox inside FIP images Ahmad Fatoum
2025-04-09 14:01 ` [PATCH 7/7] ARM: stm32mp: retire non-FIP stm32mp_bbu_mmc_register_handler Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250409140134.2079552-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox