From 7a72d89d3f8112c1f4065d43e636aa572278f42e Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Thu, 6 Oct 2016 13:39:58 +0200 Subject: libfdt: overlay: Fix symbols and fixups nodes condition Some base device tree might not have any __symbols__ nodes, since they might not have any phandle at all. Similarly, if an overlay doesn't use any base device tree phandles, its __fixups__ node will be empty. In such cases, we don't want to stop the phandle parsing, but rather just ignore the error reported about the missing node. If it's actually an issue for the overlay we're trying to apply on a given base device tree, it will be caught later on, but we cannot make the assumption that early in the application process. Signed-off-by: Maxime Ripard Signed-off-by: David Gibson --- libfdt/fdt_overlay.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c index 2f306e4..bb41404 100644 --- a/libfdt/fdt_overlay.c +++ b/libfdt/fdt_overlay.c @@ -492,13 +492,12 @@ static int overlay_fixup_phandles(void *fdt, void *fdto) /* We can have overlays without any fixups */ fixups_off = fdt_path_offset(fdto, "/__fixups__"); - if (fixups_off == -FDT_ERR_NOTFOUND) - return 0; - if (fixups_off < 0) + if ((fixups_off < 0 && (fixups_off != -FDT_ERR_NOTFOUND))) return fixups_off; + /* And base DTs without symbols */ symbols_off = fdt_path_offset(fdt, "/__symbols__"); - if (symbols_off < 0) + if ((symbols_off < 0 && (symbols_off != -FDT_ERR_NOTFOUND))) return symbols_off; fdt_for_each_property_offset(property, fdto, fixups_off) { -- cgit v1.1