qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@linaro.org>
To: eric.auger@st.com, christoffer.dall@linaro.org,
	qemu-devel@nongnu.org, agraf@suse.de, pbonzini@redhat.com,
	kim.phillips@freescale.com, a.rigo@virtualopensystems.com,
	manish.jaggi@caviumnetworks.com, joel.schopp@amd.com
Cc: peter.maydell@linaro.org, patches@linaro.org,
	eric.auger@linaro.org, will.deacon@arm.com,
	stuart.yoder@freescale.com, Bharat.Bhushan@freescale.com,
	alex.williamson@redhat.com, a.motakis@virtualopensystems.com,
	kvmarm@lists.cs.columbia.edu
Subject: [Qemu-devel] [PATCH v4 3/6] hw/arm/boot: do not free VirtBoardInfo fdt in arm_load_dtb
Date: Fri, 31 Oct 2014 13:53:29 +0000	[thread overview]
Message-ID: <1414763612-4939-4-git-send-email-eric.auger@linaro.org> (raw)
In-Reply-To: <1414763612-4939-1-git-send-email-eric.auger@linaro.org>

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@linaro.org>
---
 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

  parent reply	other threads:[~2014-10-31 15:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31 13:53 [Qemu-devel] [PATCH v4 0/6] machvirt dynamic sysbus device instantiation Eric Auger
2014-10-31 13:53 ` [Qemu-devel] [PATCH v4 1/6] hw/arm/boot: load_dtb becomes non static arm_load_dtb Eric Auger
2014-11-27  9:00   ` Shannon Zhao
2014-11-27  9:19     ` Eric Auger
2014-11-27 10:17       ` Shannon Zhao
2014-11-27 10:29         ` Eric Auger
2014-10-31 13:53 ` [Qemu-devel] [PATCH v4 2/6] hw/arm/boot: dtb start and limit moved in arm_boot_info Eric Auger
2014-10-31 13:53 ` Eric Auger [this message]
2014-10-31 13:53 ` [Qemu-devel] [PATCH v4 4/6] hw/arm: add a new modify_dtb_opaque field " Eric Auger
2014-10-31 13:53 ` [Qemu-devel] [PATCH v4 5/6] hw/arm/sysbus-fdt: helpers for platform bus nodes addition Eric Auger
2014-11-05 10:19   ` Alexander Graf
2014-11-27 12:07   ` Shannon Zhao
2014-11-27 12:25     ` Eric Auger
2014-11-27 12:56       ` Shannon Zhao
2014-11-27 13:14         ` Alexander Graf
2014-11-27 13:16         ` Eric Auger
2014-11-27 13:36           ` Shannon Zhao
2014-10-31 13:53 ` [Qemu-devel] [PATCH v4 6/6] hw/arm/virt: add dynamic sysbus device support Eric Auger
2014-11-05 10:19   ` Alexander Graf
2014-11-05 10:21 ` [Qemu-devel] [PATCH v4 0/6] machvirt dynamic sysbus device instantiation Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414763612-4939-4-git-send-email-eric.auger@linaro.org \
    --to=eric.auger@linaro.org \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=a.motakis@virtualopensystems.com \
    --cc=a.rigo@virtualopensystems.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=christoffer.dall@linaro.org \
    --cc=eric.auger@st.com \
    --cc=joel.schopp@amd.com \
    --cc=kim.phillips@freescale.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=manish.jaggi@caviumnetworks.com \
    --cc=patches@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stuart.yoder@freescale.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).