mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
libfdt: overlay: Fix phandle overwrite check for new subtrees
If the overlay's target is only created in a previous fragment, it
doesn't exist in the unmodified base device tree. For the phandle
overwrite check this can be ignored because in this case the base tree
doesn't contain a phandle that could be overwritten.
Adapt the corresponding check to not error out if that happens but just
continue with the next fragment.
This is currently triggered by
arch/arm64/boot/dts/renesas/salvator-panel-aa104xd12.dtso in the kernel
repository which creates /panel in its first fragment and modifies it in
its second.
Reported-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/all/CAL_JsqL9MPycDjqQfPNAuGfC6EMrdzUivr+fuOS7YgU3biGd4A@mail.gmail.com/
Fixes: 1fad065080
("libfdt: overlay: ensure that existing phandles are not overwritten")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20240626075551.2493048-2-u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
49d3089446
commit
61e88fdcec
3 changed files with 19 additions and 1 deletions
|
@ -729,7 +729,13 @@ static int overlay_prevent_phandle_overwrite(void *fdt, void *fdto)
|
||||||
return overlay;
|
return overlay;
|
||||||
|
|
||||||
target = fdt_overlay_target_offset(fdt, fdto, fragment, NULL);
|
target = fdt_overlay_target_offset(fdt, fdto, fragment, NULL);
|
||||||
if (target < 0)
|
if (target == -FDT_ERR_NOTFOUND)
|
||||||
|
/*
|
||||||
|
* The subtree doesn't exist in the base, so nothing
|
||||||
|
* will be overwritten.
|
||||||
|
*/
|
||||||
|
continue;
|
||||||
|
else if (target < 0)
|
||||||
return target;
|
return target;
|
||||||
|
|
||||||
ret = overlay_prevent_phandle_overwrite_node(fdt, target,
|
ret = overlay_prevent_phandle_overwrite_node(fdt, target,
|
||||||
|
|
|
@ -46,3 +46,7 @@
|
||||||
new-sub-test-property;
|
new-sub-test-property;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&{/new-local-node} {
|
||||||
|
another-new-property;
|
||||||
|
};
|
||||||
|
|
|
@ -72,6 +72,14 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
fragment@7 {
|
||||||
|
target-path = "/new-local-node";
|
||||||
|
|
||||||
|
__overlay__ {
|
||||||
|
another-new-property;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
__local_fixups__ {
|
__local_fixups__ {
|
||||||
fragment@5 {
|
fragment@5 {
|
||||||
__overlay__ {
|
__overlay__ {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue