Received: from eggs.gnu.org ([2001:4830:134:3::10]:42497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e50Mo-0006YP-TN for qemu-devel@nongnu.org; Wed, 18 Oct 2017 22:15:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e50Ml-0002hd-LS for qemu-devel@nongnu.org; Wed, 18 Oct 2017 22:15:26 -0400 Received: from ozlabs.ru ([107.173.13.209]:35006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e50Ml-0002bS-8P for qemu-devel@nongnu.org; Wed, 18 Oct 2017 22:15:23 -0400 From: Alexey Kardashevskiy Date: Thu, 19 Oct 2017 13:15:05 +1100 Message-Id: <20171019021505.30576-1-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qemu v3] pci: Initialize pci_dev->name before use List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , "Michael S. Tsirkin" This moves pci_dev->name initialization earlier so pci_dev->bus_master_as could get a name instead of an empty string. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Xu Signed-off-by: Alexey Kardashevskiy --- Changes: v3: * more "reviewed-by" * fixed spelling in commit log v2: * fixed mistype in the commit log * added "rb" --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 5ed3c8dca4..b2d139bd9a 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1030,6 +1030,7 @@ static PCIDevice *do_pci_register_device(PCIDevice = *pci_dev, PCIBus *bus, =20 pci_dev->devfn =3D devfn; pci_dev->requester_id_cache =3D pci_req_id_cache_get(pci_dev); + pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); =20 memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci= _dev), "bus master container", UINT64_MAX); @@ -1039,7 +1040,6 @@ static PCIDevice *do_pci_register_device(PCIDevice = *pci_dev, PCIBus *bus, if (qdev_hotplug) { pci_init_bus_master(pci_dev); } - pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); pci_dev->irq_state =3D 0; pci_config_alloc(pci_dev); =20 --=20 2.11.0