From patchwork Sun Nov 30 18:19:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 41720 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 23BD824001 for ; Sun, 30 Nov 2014 18:20:05 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf5870343wiv.5 for ; Sun, 30 Nov 2014 10:20:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=qGbLDDYAwF7gbMtnDuL+FMKxEoncAwNGNZTJQ13noMM=; b=b+espghXjsbqPn50/UW/s3+WOBaVFAWnfhw12XR2D2pVwtL7lME/PpU/wJdFuy1vx+ id6KrzES0qcHlk0HR+OoCUaHVzONl6HFLHpYKkUjfv7E1ZURrI6rw2bCd73j6mlAaz+A wRaGDF6a6b8l53Vo6zGRawKayz5UWcbATWfGTrYUEaNA+nSHylrg3A7XoxtkC5x6iW7r WfU2nDw/055/P8eIb+kH3714FHSZmcRov37REkFYqhXR5+4lko+Wf0TiWJ4GC4jZjFTq h1nzCwerxDScz7VOAjb5HYxLlRkJzy3PkDvNVd0gQ22Yg1BM0Pcwb55n6F2Hwt1MExFP wX4w== X-Gm-Message-State: ALoCoQnvGMGYVmi25uiLkzGMRdlWEGVR2sHZn84uxGmsSXjN0PNdfhnERiUGeBme8ldN5hwJgj6G X-Received: by 10.180.102.228 with SMTP id fr4mr12634123wib.1.1417371604457; Sun, 30 Nov 2014 10:20:04 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.202 with SMTP id u10ls840639lau.68.gmail; Sun, 30 Nov 2014 10:20:04 -0800 (PST) X-Received: by 10.112.135.229 with SMTP id pv5mr53000882lbb.52.1417371604229; Sun, 30 Nov 2014 10:20:04 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id x10si1929918lbo.132.2014.11.30.10.20.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 30 Nov 2014 10:20:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id p9so7626105lbv.28 for ; Sun, 30 Nov 2014 10:20:04 -0800 (PST) X-Received: by 10.112.14.69 with SMTP id n5mr53160242lbc.34.1417371604107; Sun, 30 Nov 2014 10:20:04 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp170834lbc; Sun, 30 Nov 2014 10:20:03 -0800 (PST) X-Received: by 10.194.59.17 with SMTP id v17mr44910718wjq.130.1417371603421; Sun, 30 Nov 2014 10:20:03 -0800 (PST) Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com. [74.125.82.44]) by mx.google.com with ESMTPS id o9si27807414wib.43.2014.11.30.10.20.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 30 Nov 2014 10:20:03 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.44 as permitted sender) client-ip=74.125.82.44; Received: by mail-wg0-f44.google.com with SMTP id b13so12504257wgh.31 for ; Sun, 30 Nov 2014 10:20:03 -0800 (PST) X-Received: by 10.180.72.33 with SMTP id a1mr76365459wiv.18.1417371602927; Sun, 30 Nov 2014 10:20:02 -0800 (PST) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id ec2sm25092772wib.23.2014.11.30.10.20.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 30 Nov 2014 10:20:02 -0800 (PST) From: Eric Auger 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, zhaoshenglong@huawei.com, ard.biesheuvel@linaro.org Cc: eric.auger@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, alex.williamson@redhat.com, peter.maydell@linaro.org, will.deacon@arm.com, Bharat.Bhushan@freescale.com, stuart.yoder@freescale.com, a.motakis@virtualopensystems.com Subject: [PATCH v5 3/6] hw/arm/boot: do not free VirtBoardInfo fdt in arm_load_dtb Date: Sun, 30 Nov 2014 18:19:27 +0000 Message-Id: <1417371570-11789-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1417371570-11789-1-git-send-email-eric.auger@linaro.org> References: <1417371570-11789-1-git-send-email-eric.auger@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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 0398cd4..0f9cd2c 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; }