* [PATCH] of: gracefully handle empty dummy DT
@ 2026-04-14 14:57 Ahmad Fatoum
2026-04-15 6:26 ` Sascha Hauer
0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2026-04-14 14:57 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum, Chali Anis
We started registering an empty dummy DT on platforms with barebox as
EFI payload to allow a multi-platform build where some enabled SoCs
expect a DT to be available.
This fixes some problems, but causes others, because we have places in
the code that assume there is always a compatible property when there is
a device tree.
Adapt these places to treat lack of oftree and compatible the same.
Fixes: 10922345fbcc ("efi: payload: register dummy device tree")
Reported-by: Chali Anis <chalianis1@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/blspec.c | 4 ++--
common/image-fit.c | 2 +-
common/oftree.c | 2 ++
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/common/blspec.c b/common/blspec.c
index c07e3a2d672d..c90bead4f355 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -336,14 +336,14 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
if (!strcmp(devicetree, "none"))
return true;
- /* If we don't have a root node every entry is compatible */
+ /* If we don't have a root node with a compatible, every entry is compatible */
barebox_root = of_get_root_node();
if (!barebox_root)
return true;
ret = of_property_read_string(barebox_root, "compatible", &compat);
if (ret)
- return false;
+ return true;
if (entry->rootpath)
abspath = entry->rootpath;
diff --git a/common/image-fit.c b/common/image-fit.c
index 7bc4665fcdbc..8e6f3d2b5d3c 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -891,7 +891,7 @@ static int fit_find_compatible_unit(struct fit_handle *handle,
ret = of_property_read_string(barebox_root, "compatible", &machine);
if (ret)
- return -ENOENT;
+ goto default_unit;
for_each_child_of_node(conf_node, child) {
int score;
diff --git a/common/oftree.c b/common/oftree.c
index 2bf1a63e4915..7aaed70e4016 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -550,6 +550,8 @@ int of_prepend_machine_compatible(struct device_node *root, const char *compat)
return 0;
curcompat = of_get_property(root, "compatible", &cclen);
+ if (!curcompat)
+ return -ENOENT;
buf = xzalloc(cclen + clen);
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] of: gracefully handle empty dummy DT
2026-04-14 14:57 [PATCH] of: gracefully handle empty dummy DT Ahmad Fatoum
@ 2026-04-15 6:26 ` Sascha Hauer
2026-04-15 6:38 ` Ahmad Fatoum
0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2026-04-15 6:26 UTC (permalink / raw)
To: barebox, Ahmad Fatoum; +Cc: Chali Anis
On Tue, 14 Apr 2026 16:57:33 +0200, Ahmad Fatoum wrote:
> We started registering an empty dummy DT on platforms with barebox as
> EFI payload to allow a multi-platform build where some enabled SoCs
> expect a DT to be available.
>
> This fixes some problems, but causes others, because we have places in
> the code that assume there is always a compatible property when there is
> a device tree.
>
> [...]
Applied, thanks!
[1/1] of: gracefully handle empty dummy DT
https://git.pengutronix.de/cgit/barebox/commit/?id=90ec6d81c1d1 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] of: gracefully handle empty dummy DT
2026-04-15 6:26 ` Sascha Hauer
@ 2026-04-15 6:38 ` Ahmad Fatoum
0 siblings, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2026-04-15 6:38 UTC (permalink / raw)
To: Sascha Hauer, barebox; +Cc: Chali Anis
Hello Sascha,
On 4/15/26 08:26, Sascha Hauer wrote:
>
> On Tue, 14 Apr 2026 16:57:33 +0200, Ahmad Fatoum wrote:
>> We started registering an empty dummy DT on platforms with barebox as
>> EFI payload to allow a multi-platform build where some enabled SoCs
>> expect a DT to be available.
>>
>> This fixes some problems, but causes others, because we have places in
>> the code that assume there is always a compatible property when there is
>> a device tree.
>>
>> [...]
>
> Applied, thanks!
Thanks. I forgot to mention this is also for master as the issue is already in a release.
>
> [1/1] of: gracefully handle empty dummy DT
> https://git.pengutronix.de/cgit/barebox/commit/?id=90ec6d81c1d1 (link may not be stable)
>
> Best regards,
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-15 6:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-14 14:57 [PATCH] of: gracefully handle empty dummy DT Ahmad Fatoum
2026-04-15 6:26 ` Sascha Hauer
2026-04-15 6:38 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox