Move releasing of resources to later

Turn off bus master after we detach the device (to match the prior
order).  Release MSI after we're done detaching and have turned off
all the interrupts. Otherwise this may cause problems as other threads
race nvme_detach. This more closely matches the old order.

Reviewed by: mav@
This commit is contained in:
imp 2019-08-22 20:09:32 +00:00
parent 883b4d95e4
commit 670af8055b

View File

@ -215,11 +215,13 @@ static int
nvme_pci_detach(device_t dev)
{
struct nvme_controller*ctrlr = DEVICE2SOFTC(dev);
int rv;
rv = nvme_detach(dev);
if (ctrlr->msix_enabled)
pci_release_msi(dev);
pci_disable_busmaster(dev);
return (nvme_detach(dev));
return (rv);
}
static int