[PATCH] smbios: Do not look up children of invalid nodes

Samuel Holland samuel.holland at sifive.com
Mon Apr 14 21:47:04 CEST 2025


If there is no UCLASS_SYSINFO device available, parent_node will be
ofnode_null(). Calling ofnode_find_subnode() then triggers an assertion:

  drivers/core/ofnode.c:598: ofnode_find_subnode: Assertion `ofnode_valid(node)' failed.

Check for a valid parent_node, not just that OF_CONTROL is enabled.

Fixes: 44ffb6f0ecaf ("smbios: Allow properties to come from the device tree")
Signed-off-by: Samuel Holland <samuel.holland at sifive.com>
---

 lib/smbios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/smbios.c b/lib/smbios.c
index 7c9701a57f9..b8c2846277a 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -950,7 +950,7 @@ ulong write_smbios_table(ulong addr)
 		ctx.subnode_name = NULL;
 		if (method->subnode_name) {
 			ctx.subnode_name = method->subnode_name;
-			if (IS_ENABLED(CONFIG_OF_CONTROL))
+			if (ofnode_valid(parent_node))
 				ctx.node = ofnode_find_subnode(parent_node,
 							       method->subnode_name);
 		}
-- 
2.47.2

base-commit: 739ad58dbee874a3ad3bddd116e995212a254e07
branch: up/smbios-assert-fix


More information about the U-Boot mailing list