aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-04-04 17:27:32 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-04-04 17:27:32 +0100
commit2c9938c5d71a634fd71c731658f57d9ba6299bad (patch)
tree4117f20527a8a40d6a434c0ba6dd9871796d45c9
parentfa902c8ca0f3b83e0e3dda1e9e00f0b1d28e718a (diff)
parent193982c6f9424779b53a168fe32ebc30a776cbf1 (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
pci: fix A single bugfix for a error handling issue in pci. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 04 Apr 2017 16:33:04 BST # gpg: using RSA key 0x281F0DB8D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: pci: Only unmap bus_master_enabled_region if was added previously Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/pci/pci.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index bd8043c460..259483b1c0 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -869,8 +869,10 @@ 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);
+ if (memory_region_is_mapped(&pci_dev->bus_master_enable_region)) {
+ memory_region_del_subregion(&pci_dev->bus_master_container_region,
+ &pci_dev->bus_master_enable_region);
+ }
address_space_destroy(&pci_dev->bus_master_as);
}