[PATCH] lib: utils/fdt: fdt_find_match skip disabled node

Xiang W wxjstz at 126.com
Sun May 26 18:55:32 PDT 2024


Some node in devicetree are disabled and need to be skipped during
initialization.

Signed-off-by: Xiang W <wxjstz at 126.com>
---
 lib/utils/fdt/fdt_helper.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c
index a0e93b9..ef627b7 100644
--- a/lib/utils/fdt/fdt_helper.c
+++ b/lib/utils/fdt/fdt_helper.c
@@ -65,9 +65,11 @@ int fdt_find_match(void *fdt, int startoff,
 		nodeoff = fdt_node_offset_by_compatible(fdt, startoff,
 						match_table->compatible);
 		if (nodeoff >= 0) {
-			if (out_match)
-				*out_match = match_table;
-			return nodeoff;
+			if (fdt_node_is_enabled(fdt, nodeoff)) {
+				if (out_match)
+					*out_match = match_table;
+				return nodeoff;
+			}
 		}
 		match_table++;
 	}
-- 
2.43.0




More information about the opensbi mailing list