diff options
author | Michal Suchanek <hramrach@gmail.com> | 2016-07-19 01:01:12 +0300 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2016-07-19 01:27:04 +0300 |
commit | 1d1bde550ea3b08a95bd9b6b3adb6d7cd3781870 (patch) | |
tree | 819c9f8d12c770d8da96463aa9096289979002fe /drivers/of | |
parent | 5de3bbc8501b637eb753e4ee18a2cccb233cfe41 (diff) | |
download | linux-1d1bde550ea3b08a95bd9b6b3adb6d7cd3781870.tar.xz |
of: fdt: mark unflattened tree as detached
The tree returned from of_fdt_unflatten_tree cannot be attached to the
live tree because it is not marked as detached so mark it as such. The
dt resolver checks the flag and refuses to process the tree otherwise.
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/fdt.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index a0a7b76be381..ae4d07bcce24 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -472,7 +472,8 @@ static int unflatten_dt_nodes(const void *blob, static void *__unflatten_device_tree(const void *blob, struct device_node *dad, struct device_node **mynodes, - void *(*dt_alloc)(u64 size, u64 align)) + void *(*dt_alloc)(u64 size, u64 align), + bool detached) { int size; void *mem; @@ -516,6 +517,11 @@ static void *__unflatten_device_tree(const void *blob, pr_warning("End of tree marker overwritten: %08x\n", be32_to_cpup(mem + size)); + if (detached) { + of_node_set_flag(*mynodes, OF_DETACHED); + pr_debug("unflattened tree is detached\n"); + } + pr_debug(" <- unflatten_device_tree()\n"); return mem; } @@ -548,7 +554,8 @@ void *of_fdt_unflatten_tree(const unsigned long *blob, void *mem; mutex_lock(&of_fdt_unflatten_mutex); - mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc); + mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc, + true); mutex_unlock(&of_fdt_unflatten_mutex); return mem; @@ -1224,7 +1231,7 @@ bool __init early_init_dt_scan(void *params) void __init unflatten_device_tree(void) { __unflatten_device_tree(initial_boot_params, NULL, &of_root, - early_init_dt_alloc_memory_arch); + early_init_dt_alloc_memory_arch, false); /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */ of_alias_scan(early_init_dt_alloc_memory_arch); |