[PATCH 07/10] bootm: have bootm_get_devicetree return NULL if passed empty DT

Ahmad Fatoum a.fatoum at pengutronix.de
Wed May 28 03:50:43 PDT 2025


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

Signed-off-by: Ahmad Fatoum <a.fatoum at 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




More information about the barebox mailing list