aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2017-03-27 15:40:30 +1100
committerMichael S. Tsirkin <mst@redhat.com>2017-03-29 02:35:23 +0300
commitc53598ed18e40a9609573b21f2a361221ca0f806 (patch)
tree6cfa05fd7ecb135c22183d822d582e660ae6830c
parentaa262928595d431bfee7914cb7d9d79197f887a2 (diff)
pci: Add missing drop of bus master AS reference
The recent introduction of a bus master container added memory_region_add_subregion() into the PCI device registering path but missed memory_region_del_subregion() in the unregistering path leaving a reference to the root memory region of the new container. This adds missing memory_region_del_subregion(). Fixes: 3716d5902d743 ("pci: introduce a bus master container") 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> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--hw/pci/pci.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index e6b08e1988..bd8043c460 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -869,6 +869,8 @@ static void do_pci_unregister_device(PCIDevice *pci_dev)
pci_dev->bus->devices[pci_dev->devfn] = NULL;
pci_config_free(pci_dev);
+ memory_region_del_subregion(&pci_dev->bus_master_container_region,
+ &pci_dev->bus_master_enable_region);
address_space_destroy(&pci_dev->bus_master_as);
}