mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-22 20:58:22 +00:00
dm: core: Avoid registering an inaccessible tree
At present there are various restrictions on the use of livetree: - It is only available once the tree is unflattened, i.e. after relocation - It is designed to be used with the control FDT - It can (in principle) be used with other FDTs, but only if they are unflattened first; this is not supported Add a few checks to make sure that any tree that is created is actually valid. Otherwise it can be confusing when nodes and properties cannot actually be accessed. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
11c341b118
commit
a6c4f18894
1 changed files with 9 additions and 0 deletions
|
@ -60,6 +60,11 @@ static oftree oftree_ensure(void *fdt)
|
||||||
return oftree_null();
|
return oftree_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (of_live_active()) {
|
||||||
|
log_err("Cannot register a flattree when OF_LIVE is active\n");
|
||||||
|
return oftree_null();
|
||||||
|
}
|
||||||
|
|
||||||
/* register the new tree */
|
/* register the new tree */
|
||||||
i = oftree_count++;
|
i = oftree_count++;
|
||||||
oftree_list[i] = fdt;
|
oftree_list[i] = fdt;
|
||||||
|
@ -133,6 +138,10 @@ oftree oftree_from_fdt(void *fdt)
|
||||||
if (CONFIG_IS_ENABLED(OFNODE_MULTI_TREE))
|
if (CONFIG_IS_ENABLED(OFNODE_MULTI_TREE))
|
||||||
return oftree_ensure(fdt);
|
return oftree_ensure(fdt);
|
||||||
|
|
||||||
|
#ifdef OF_CHECKS
|
||||||
|
if (of_live_active())
|
||||||
|
return oftree_null();
|
||||||
|
#endif
|
||||||
tree.fdt = fdt;
|
tree.fdt = fdt;
|
||||||
|
|
||||||
return tree;
|
return tree;
|
||||||
|
|
Loading…
Add table
Reference in a new issue