diff options
author | Jason Baron <jbaron@redhat.com> | 2012-05-02 22:42:15 -0400 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2012-06-25 08:55:19 -0500 |
commit | dbe4ac16bbab4c237ff54132968accad4f5a4757 (patch) | |
tree | 456df9d309aaed5121da4b6c751da4482205489c | |
parent | f63e60327b8e239ae97fa71060940ca20a8bf38e (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>
(cherry picked from commit 80aa796bf38b7ef21daa42673b4711510c450d8a)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-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 eccaa5831e..ad63703c04 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; } |