mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 07/10] bootm: have bootm_get_devicetree return NULL if passed empty DT
Date: Wed, 28 May 2025 12:50:43 +0200	[thread overview]
Message-ID: <20250528105046.3270397-8-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250528105046.3270397-1-a.fatoum@pengutronix.de>

This will allow users to force boot of an image without passing a device
tree.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 common/bootm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/bootm.c b/common/bootm.c
index 4c5913ffb95c..4aebc8a66abd 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -418,7 +418,8 @@ static bool fitconfig_has_fdt(struct image_data *data)
  * devicetree. It returns a pointer to the allocated devicetree which must be
  * freed after use.
  *
- * Return: pointer to the fixed devicetree or a ERR_PTR() on failure.
+ * Return: pointer to the fixed devicetree, NULL if image_data has an empty DT
+ *         or a ERR_PTR() on failure.
  */
 void *bootm_get_devicetree(struct image_data *data)
 {
@@ -463,6 +464,8 @@ void *bootm_get_devicetree(struct image_data *data)
 			ret = read_file_2(data->oftree_file, &size, (void *)&oftree,
 					  FILESIZE_MAX);
 			break;
+		case filetype_empty:
+			return NULL;
 		default:
 			return ERR_PTR(-EINVAL);
 		}
-- 
2.39.5




  parent reply	other threads:[~2025-05-28 12:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28 10:50 [PATCH 00/10] ARM32: allow disabling ATAGS and DT fallback Ahmad Fatoum
2025-05-28 10:50 ` [PATCH 01/10] arch: add new HAVE_ARCH_BOOTM_OFTREE symbol Ahmad Fatoum
2025-05-28 10:50 ` [PATCH 02/10] bootm: enable CONFIG_BOOTM_OFTREE by default Ahmad Fatoum
2025-05-28 10:50 ` [PATCH 03/10] ARM: lib32: disable ATAGS support " Ahmad Fatoum
2025-05-28 10:50 ` [PATCH 04/10] kvx: bootm: enforce existence of device tree Ahmad Fatoum
2025-05-28 10:50 ` [PATCH 05/10] bootm: booti: make device tree optional Ahmad Fatoum
2025-05-28 10:50 ` [PATCH 06/10] filetype: add new file type for 0-sized files Ahmad Fatoum
2025-05-28 10:50 ` Ahmad Fatoum [this message]
2025-05-28 10:50 ` [PATCH 08/10] bootm: make fallback to barebox internal tree optional Ahmad Fatoum
2025-05-28 10:50 ` [PATCH 09/10] commands: oftree: add option to return device tree without fixups Ahmad Fatoum
2025-05-28 10:50 ` [PATCH 10/10] of: drop undefined fdt_get_tree declaration 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=20250528105046.3270397-8-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