+4
−2
Loading
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: c53598ed ("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>