[PATCH 01/14] dm: core: Avoid registering an invalid tree in oftree_ensure()
Simon Glass
sjg at chromium.org
Fri Sep 9 17:17:48 CEST 2022
If the tree is not valid we should not register it. Update the function
to check this first.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
drivers/core/ofnode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 6bdab6886b6..9a782e7b19f 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -51,7 +51,7 @@ static oftree oftree_ensure(void *fdt)
oftree tree;
int i;
- if (gd->flags & GD_FLG_RELOC) {
+ if (fdt && (gd->flags & GD_FLG_RELOC)) {
i = oftree_find(fdt);
if (i == -1) {
if (oftree_count == CONFIG_OFNODE_MULTI_TREE_MAX) {
--
2.37.2.789.g6183377224-goog
More information about the U-Boot
mailing list