diff options
author | Jason Baron <jbaron@redhat.com> | 2012-05-02 22:42:15 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2012-06-11 22:55:13 +0300 |
commit | 80aa796bf38b7ef21daa42673b4711510c450d8a (patch) | |
tree | 4285fabc369601809ec99108b510fbe78aad50d9 /hw | |
parent | 266ca11a0433643a3cc3146a9837d9f2b0bfbe3b (diff) |
pci_bridge_dev: fix error path in pci_bridge_dev_initfn()
Currently, we do not properly cleanup, if pci_bridge_dev_initfn
fails to initialize properly. Make sure to call pci_bridge_exitfn()
in the error path.
Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pci_bridge_dev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/pci_bridge_dev.c b/hw/pci_bridge_dev.c index b6d5fb7388..1cc1d2049c 100644 --- a/hw/pci_bridge_dev.c +++ b/hw/pci_bridge_dev.c @@ -52,7 +52,7 @@ static int pci_bridge_dev_initfn(PCIDevice *dev) { PCIBridge *br = DO_UPCAST(PCIBridge, dev, dev); PCIBridgeDev *bridge_dev = DO_UPCAST(PCIBridgeDev, bridge, br); - int err; + int err, ret; pci_bridge_map_irq(br, NULL, pci_bridge_dev_map_irq_fn); err = pci_bridge_initfn(dev); if (err) { @@ -86,6 +86,8 @@ slotid_error: shpc_cleanup(dev, &bridge_dev->bar); shpc_error: memory_region_destroy(&bridge_dev->bar); + ret = pci_bridge_exitfn(dev); + assert(!ret); bridge_error: return err; } |