Alexey Kardashevskiy 193982c6f9 pci: Only unmap bus_master_enabled_region if was added previously
Normally pci_init_bus_master() would be called either via
bus->machine_done.notify or directly from do_pci_register_device().

However if a device's realize() failed, pci_init_bus_master() is not
called, and do_pci_unregister_device() fails on
memory_region_del_subregion() as it was not mapped.

This adds a check that subregion was mapped before unmapping it.

Fixes: c53598ed18e4 ("pci: Add missing drop of bus master AS reference")
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: Max Reitz <mreitz@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: John Snow <jsnow@redhat.com>
2017-04-04 18:32:25 +03:00
..
2017-03-27 21:13:19 +02:00
2017-01-27 18:08:00 +01:00
2017-03-27 12:14:45 +02:00
2017-01-20 11:15:06 +00:00
2017-03-27 12:14:45 +02:00
2017-04-02 21:17:47 +02:00
2017-02-06 12:33:21 +11:00
2017-01-27 18:07:59 +01:00
2017-02-24 10:37:21 +00:00
2017-03-31 08:48:13 +08:00
2017-02-28 20:40:36 +01:00
2017-02-02 18:48:06 +00:00
2017-02-24 10:13:57 +00:00
2017-03-27 17:34:50 +01:00
2017-03-01 23:09:46 +00:00
2017-02-28 16:18:49 +00:00