From patchwork Tue Jun 4 18:52:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 248842 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5A51D2C0079 for ; Wed, 5 Jun 2013 05:11:19 +1000 (EST) Received: from localhost ([::1]:35983 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwdZ-0001jz-Dy for incoming@patchwork.ozlabs.org; Tue, 04 Jun 2013 15:11:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwMV-0008Ev-Sn for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjwMU-0007mA-PR for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:39 -0400 Received: from mail-wg0-x235.google.com ([2a00:1450:400c:c00::235]:53085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwMU-0007l5-Jp for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:38 -0400 Received: by mail-wg0-f53.google.com with SMTP id c11so559605wgh.20 for ; Tue, 04 Jun 2013 11:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=jrr2CGzVJXkjImI94VagiQrgAw06er7Tz11FPAYiM+s=; b=l7eSERw+rWkn/+ungy7WFQQhlqnGRTcFwARsl9pHSO19oNjSIOAcTdK7uzMWP27z9V 1SzUaayi93IrD2RFO0EZjcmXLp2Y7quFHicNnG2EWUwqYdww7Jh29QETC5WDlKUAt3cN gnM2j8TT0jhMZ23lvQPDzdCkyMiTFELmZ7dilCXXPzOXuDhy+G7yFqWuJXTZVdyMxgu1 B7cpLIQe4+GN79GjPIOc/XNwpwhb/v6yX+0LJBwdGYpBxw2RE4Qz73JLBXXvDw3UIcB+ Ro7eteNnp+gCfp7nAuVOj2kedCWCRqGnV1HnuMQRivAe+QTKdQ+saSDHmfoqlmXnU18b xJAA== X-Received: by 10.180.185.44 with SMTP id ez12mr2904845wic.7.1370372017930; Tue, 04 Jun 2013 11:53:37 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id fx7sm4590484wic.11.2013.06.04.11.53.36 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Jun 2013 11:53:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 4 Jun 2013 20:52:21 +0200 Message-Id: <1370371954-8479-27-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370371954-8479-1-git-send-email-pbonzini@redhat.com> References: <1370371954-8479-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::235 Cc: mst@redhat.com Subject: [Qemu-devel] [PATCH 26/39] pcie_aer: pcie_aer_exit really frees stuff X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Rename it, and move its call towards the end to prepare for unrealize/instance_finalize split. Signed-off-by: Paolo Bonzini --- hw/pci-bridge/ioh3420.c | 2 +- hw/pci-bridge/xio3130_downstream.c | 2 +- hw/pci-bridge/xio3130_upstream.c | 2 +- hw/pci/pcie_aer.c | 3 ++- include/hw/pci/pcie_aer.h | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c index 74ab7c8..0a3cbb7 100644 --- a/hw/pci-bridge/ioh3420.c +++ b/hw/pci-bridge/ioh3420.c @@ -153,11 +153,11 @@ static void ioh3420_exitfn(PCIDevice *d) PCIEPort *p = DO_UPCAST(PCIEPort, br, br); PCIESlot *s = DO_UPCAST(PCIESlot, port, p); - pcie_aer_exit(d); pcie_chassis_del_slot(s); pcie_cap_exit(d); msi_uninit(d); pci_bridge_exitfn(d); + pcie_aer_free(d); pci_bridge_free(d); } diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c index 57af725..6ff336f 100644 --- a/hw/pci-bridge/xio3130_downstream.c +++ b/hw/pci-bridge/xio3130_downstream.c @@ -118,11 +118,11 @@ static void xio3130_downstream_exitfn(PCIDevice *d) PCIEPort *p = DO_UPCAST(PCIEPort, br, br); PCIESlot *s = DO_UPCAST(PCIESlot, port, p); - pcie_aer_exit(d); pcie_chassis_del_slot(s); pcie_cap_exit(d); msi_uninit(d); pci_bridge_exitfn(d); + pcie_aer_free(d); pci_bridge_free(d); } diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c index 58c3d29..9485f5e 100644 --- a/hw/pci-bridge/xio3130_upstream.c +++ b/hw/pci-bridge/xio3130_upstream.c @@ -101,10 +101,10 @@ err_bridge: static void xio3130_upstream_exitfn(PCIDevice *d) { - pcie_aer_exit(d); pcie_cap_exit(d); msi_uninit(d); pci_bridge_exitfn(d); + pcie_aer_free(d); pci_bridge_free(d); } diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c index 1ce72ce..7db4e8e 100644 --- a/hw/pci/pcie_aer.c +++ b/hw/pci/pcie_aer.c @@ -163,9 +163,10 @@ int pcie_aer_init(PCIDevice *dev, uint16_t offset) return 0; } -void pcie_aer_exit(PCIDevice *dev) +void pcie_aer_free(PCIDevice *dev) { g_free(dev->exp.aer_log.log); + dev->exp.aer_log.log = NULL; } static void pcie_aer_update_uncor_status(PCIDevice *dev) diff --git a/include/hw/pci/pcie_aer.h b/include/hw/pci/pcie_aer.h index bcac80a..af1dec3 100644 --- a/include/hw/pci/pcie_aer.h +++ b/include/hw/pci/pcie_aer.h @@ -88,7 +88,7 @@ struct PCIEAERErr { extern const VMStateDescription vmstate_pcie_aer_log; int pcie_aer_init(PCIDevice *dev, uint16_t offset); -void pcie_aer_exit(PCIDevice *dev); +void pcie_aer_free(PCIDevice *dev); void pcie_aer_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len);