diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c index e19506f..28b667f 100644 --- a/libfdt/fdt_overlay.c +++ b/libfdt/fdt_overlay.c @@ -729,7 +729,13 @@ static int overlay_prevent_phandle_overwrite(void *fdt, void *fdto) return overlay; 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; ret = overlay_prevent_phandle_overwrite_node(fdt, target, diff --git a/tests/overlay_overlay_bypath.dts b/tests/overlay_overlay_bypath.dts index f23e7b6..dfcb7cd 100644 --- a/tests/overlay_overlay_bypath.dts +++ b/tests/overlay_overlay_bypath.dts @@ -46,3 +46,7 @@ new-sub-test-property; }; }; + +&{/new-local-node} { + another-new-property; +}; diff --git a/tests/overlay_overlay_no_fixups.dts b/tests/overlay_overlay_no_fixups.dts index e8d0f96..1dbdcdc 100644 --- a/tests/overlay_overlay_no_fixups.dts +++ b/tests/overlay_overlay_no_fixups.dts @@ -72,6 +72,14 @@ }; }; + fragment@7 { + target-path = "/new-local-node"; + + __overlay__ { + another-new-property; + }; + }; + __local_fixups__ { fragment@5 { __overlay__ {