Received: from eggs.gnu.org ([2001:4830:134:3::10]:46837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPQoh-0001Bt-R4 for qemu-devel@nongnu.org; Tue, 19 Jul 2016 04:55:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPQog-0007kU-Sf for qemu-devel@nongnu.org; Tue, 19 Jul 2016 04:55:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPQog-0007kQ-N7 for qemu-devel@nongnu.org; Tue, 19 Jul 2016 04:55:50 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A8F9883AB for ; Tue, 19 Jul 2016 08:55:50 +0000 (UTC) From: marcandre.lureau@redhat.com Date: Tue, 19 Jul 2016 12:54:18 +0400 Message-Id: <20160719085432.4572-24-marcandre.lureau@redhat.com> In-Reply-To: <20160719085432.4572-1-marcandre.lureau@redhat.com> References: <20160719085432.4572-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 23/37] pci-bus: do not allocate and leak bsel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-Andr=C3=A9 Lureau Use a PCIBus attribute to store the bsel value, instead of allocating and leaking it elsewhere. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/i386/acpi-build.c | 7 ++----- include/hw/pci/pci_bus.h | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index f4ba3a4..c1e7d93 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -428,14 +428,11 @@ build_madt(GArray *table_data, BIOSLinker *linker, = PCMachineState *pcms) static void *acpi_set_bsel(PCIBus *bus, void *opaque) { unsigned *bsel_alloc =3D opaque; - unsigned *bus_bsel; =20 if (qbus_is_hotpluggable(BUS(bus))) { - bus_bsel =3D g_malloc(sizeof *bus_bsel); - - *bus_bsel =3D (*bsel_alloc)++; + bus->bus_bsel =3D (*bsel_alloc)++; object_property_add_uint32_ptr(OBJECT(bus), ACPI_PCIHP_PROP_BSEL= , - bus_bsel, NULL); + &bus->bus_bsel, NULL); } =20 return bsel_alloc; diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h index 5484a9b..686cc7c 100644 --- a/include/hw/pci/pci_bus.h +++ b/include/hw/pci/pci_bus.h @@ -41,6 +41,7 @@ struct PCIBus { int *irq_count; =20 Notifier machine_done; + unsigned bus_bsel; }; =20 typedef struct PCIBridgeWindows PCIBridgeWindows; --=20 2.9.0