]> Git Repo - qemu.git/commitdiff
pci: Initialize pci_dev->name before use
authorAlexey Kardashevskiy <[email protected]>
Thu, 19 Oct 2017 02:15:05 +0000 (13:15 +1100)
committerMichael S. Tsirkin <[email protected]>
Thu, 16 Nov 2017 15:46:53 +0000 (17:46 +0200)
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é <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Signed-off-by: Alexey Kardashevskiy <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
hw/pci/pci.c

index 5ed3c8dca418a661842c91e26bd30e3f89fe885b..b2d139bd9ad9a59c6a899df0675075106c76cb90 100644 (file)
@@ -1030,6 +1030,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
 
     pci_dev->devfn = devfn;
     pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev);
+    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
 
     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 = 0;
     pci_config_alloc(pci_dev);
 
This page took 0.024567 seconds and 4 git commands to generate.