summaryrefslogtreecommitdiffstats
path: root/hw/pci.c
diff options
context:
space:
mode:
authorMarkus Armbruster2009-10-07 01:15:58 +0200
committerAnthony Liguori2009-10-07 15:54:54 +0200
commite23a1b33b53d25510320b26d9f154e19c6c99725 (patch)
tree2c0c5b9ac463c9e9ed745d1ea1837892cac139f3 /hw/pci.c
parentCheck return value of qdev_init() (diff)
downloadqemu-e23a1b33b53d25510320b26d9f154e19c6c99725.tar.gz
qemu-e23a1b33b53d25510320b26d9f154e19c6c99725.tar.xz
qemu-e23a1b33b53d25510320b26d9f154e19c6c99725.zip
New qdev_init_nofail()
Like qdev_init(), but terminate program via hw_error() instead of returning an error value. Use it instead of qdev_init() where terminating the program on failure is okay, either because it's during machine construction, or because we know that failure can't happen. Because relying in the latter is somewhat unclean, and the former is not always obvious, it would be nice to go back to qdev_init() in the not-so-obvious cases, only with proper error handling. I'm leaving that for another day, because it involves making sure that error values are properly checked by all callers. Patchworks-ID: 35168 Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/pci.c b/hw/pci.c
index da5cc56256..49651d09f0 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -946,7 +946,7 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
dev = pci_create(bus, devfn, "pci-bridge");
qdev_prop_set_uint32(&dev->qdev, "vendorid", vid);
qdev_prop_set_uint32(&dev->qdev, "deviceid", did);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
s = DO_UPCAST(PCIBridge, dev, dev);
pci_register_secondary_bus(&s->bus, &s->dev, map_irq, name);
@@ -1010,7 +1010,7 @@ PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name)
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
{
PCIDevice *dev = pci_create(bus, devfn, name);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
return dev;
}