[PATCH 1/1] lib: utils: check correct value in fdt_node_offset_by_compatible

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Mon Apr 8 00:37:32 PDT 2024


After calling fdt_node_offset_by_compatible() we must check its return
value and not an unrelated value.

Addresses-Coverity-ID: 1584993 Logically dead code
Fixes: 67ce5a763cfb ("platform: generic: Add support for specify coldboot harts in DT")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 lib/utils/fdt/fdt_fixup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c
index 194e55b..974b1b8 100644
--- a/lib/utils/fdt/fdt_fixup.c
+++ b/lib/utils/fdt/fdt_fixup.c
@@ -394,7 +394,7 @@ void fdt_config_fixup(void *fdt)
 		return;
 
 	config_offset = fdt_node_offset_by_compatible(fdt, chosen_offset, "opensbi,config");
-	if (chosen_offset < 0)
+	if (config_offset < 0)
 		return;
 
 	fdt_nop_node(fdt, config_offset);
-- 
2.43.0




More information about the opensbi mailing list