From patchwork Fri Oct 31 13:53:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 39896 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3C9E5202FE for ; Fri, 31 Oct 2014 13:53:52 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id k14sf4131766wgh.3 for ; Fri, 31 Oct 2014 06:53:51 -0700 (PDT) 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=iJ4lmT+a45kMmcNtjJUQnTKoZap7JTbVBlj8cDmm7i8=; b=jcIzK4/amT6Vo0X6jV/GBAp7R1/rSuJFCNYeAxsFLhRR+Js7pVXa3Du7CTN6nbwCIn SFeqpvq72KIJCE+FB3ToLZsWr45vsg00i1J5QnJcz3b1ZVwtQt2EJ4AJXVdn3obzjQWC 8CLM9YsUMMU7bexKnF3B84iPGreV3oRbb24X1psPymYikQ+aGK9yw2eSE0pFfGsEcC2I 2QsUFZNN5pIZFMf2fl9VtF13+gRZGkiDSm1qUU5DsbggB6n49eatZqyos8aizHGHk9M+ 65mH1FpnZqWzwp/88toZf5Wr6ewH2uwO7kU93jkXfwilvlib5IO5+qOZfr1zSo4cTu8e tGzw== X-Gm-Message-State: ALoCoQmSTKSOwcwIeXj5T8+6YN0r+Ycg0/8aFqomCt3g8isAKLMrBwulfifBfjWykwb0EXSj5TsW X-Received: by 10.180.105.74 with SMTP id gk10mr698128wib.0.1414763631387; Fri, 31 Oct 2014 06:53:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.103 with SMTP id x7ls421896laj.37.gmail; Fri, 31 Oct 2014 06:53:51 -0700 (PDT) X-Received: by 10.112.166.1 with SMTP id zc1mr26237906lbb.90.1414763631296; Fri, 31 Oct 2014 06:53:51 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id h3si16779012lbc.88.2014.10.31.06.53.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 06:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id n15so6160886lbi.3 for ; Fri, 31 Oct 2014 06:53:50 -0700 (PDT) X-Received: by 10.112.12.35 with SMTP id v3mr26380453lbb.80.1414763630801; Fri, 31 Oct 2014 06:53:50 -0700 (PDT) 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.84.229 with SMTP id c5csp205531lbz; Fri, 31 Oct 2014 06:53:50 -0700 (PDT) X-Received: by 10.180.109.100 with SMTP id hr4mr4057327wib.39.1414763630216; Fri, 31 Oct 2014 06:53:50 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com. [209.85.212.169]) by mx.google.com with ESMTPS id fx7si26678395wib.18.2014.10.31.06.53.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 06:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.169 as permitted sender) client-ip=209.85.212.169; Received: by mail-wi0-f169.google.com with SMTP id n3so1338376wiv.4 for ; Fri, 31 Oct 2014 06:53:50 -0700 (PDT) X-Received: by 10.180.20.162 with SMTP id o2mr4102159wie.57.1414763630022; Fri, 31 Oct 2014 06:53:50 -0700 (PDT) Received: from midway01-04-00.lavalab ([88.98.47.97]) by mx.google.com with ESMTPSA id w13sm12167570wjq.29.2014.10.31.06.53.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 06:53:49 -0700 (PDT) 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 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 v4 3/6] hw/arm/boot: do not free VirtBoardInfo fdt in arm_load_dtb Date: Fri, 31 Oct 2014 13:53:29 +0000 Message-Id: <1414763612-4939-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1414763612-4939-1-git-send-email-eric.auger@linaro.org> References: <1414763612-4939-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.172 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 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; }