Currently arm_load_dtb frees the fdt handle whatever it is allocated from load_device_tree or allocated externally. When adding dynamic sysbus nodes after the first dtb load, we would like to reuse the fdt used during the first load instead of re-creating the whole device tree. If the fdt is destroyed, this is not possible. Signed-off-by: Eric Auger <eric.auger@xxxxxxxxxx> --- hw/arm/boot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 9f0662e..0e4b078 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -427,12 +427,16 @@ int arm_load_dtb(const struct arm_boot_info *binfo) */ rom_add_blob_fixed("dtb", fdt, size, binfo->dtb_start); - g_free(fdt); + if (binfo->dtb_filename) { + g_free(fdt); + } return size; fail: - g_free(fdt); + if (binfo->dtb_filename) { + g_free(fdt); + } return -1; } -- 1.8.3.2 _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm