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>
This commit is contained in:
parent
266ca11a04
commit
80aa796bf3
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user