diff mbox series

[01/14] dm: core: Avoid registering an invalid tree in oftree_ensure()

Message ID 20220909151801.336551-2-sjg@chromium.org
State Superseded
Delegated to: Tom Rini
Headers show
Series vbe: Support device tree fixups for OS requests | expand

Commit Message

Simon Glass Sept. 9, 2022, 3:17 p.m. UTC
If the tree is not valid we should not register it. Update the function
to check this first.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/ofnode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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) {