[PATCH 2/2] devinfo: print / as device tree node for the root node

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Oct 15 02:27:02 PDT 2025


The root node has an empty name and thus %pOF returns an empty string.
This is confusing for the machine device, so print just a / in that
case.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 commands/devinfo.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/commands/devinfo.c b/commands/devinfo.c
index e132f88bf3f3..c87b30e84307 100644
--- a/commands/devinfo.c
+++ b/commands/devinfo.c
@@ -108,7 +108,11 @@ static int do_devinfo(int argc, char *argv[])
 			       dev_is_dma_coherent(dev) ? "true" : "false",
 			       dev->dma_coherent == DEV_DMA_COHERENCE_DEFAULT ? " (default)" : "");
 
-			printf("Device node: %pOF", dev->of_node);
+			if (dev->of_node->parent)
+				printf("Device node: %pOF", dev->of_node);
+			else
+				printf("Device node: %s", "/");
+
 			if (!main_dev) {
 			       printf(" (unpopulated)\n");
 			} else if (main_dev != dev) {
-- 
2.47.3




More information about the barebox mailing list