mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 19:49:43 +00:00
pci: Initialize pci_dev->name before use
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é <f4bug@amsat.org> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
7abea552ab
commit
d06bce95ff
@ -1030,6 +1030,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
|||||||
|
|
||||||
pci_dev->devfn = devfn;
|
pci_dev->devfn = devfn;
|
||||||
pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev);
|
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),
|
memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev),
|
||||||
"bus master container", UINT64_MAX);
|
"bus master container", UINT64_MAX);
|
||||||
@ -1039,7 +1040,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
|||||||
if (qdev_hotplug) {
|
if (qdev_hotplug) {
|
||||||
pci_init_bus_master(pci_dev);
|
pci_init_bus_master(pci_dev);
|
||||||
}
|
}
|
||||||
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
|
|
||||||
pci_dev->irq_state = 0;
|
pci_dev->irq_state = 0;
|
||||||
pci_config_alloc(pci_dev);
|
pci_config_alloc(pci_dev);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user