diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 5b66def7b9b6..2da694f76c90 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3578,9 +3578,6 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) nvme_unquiesce_admin_queue(&dev->ctrl); } mutex_unlock(&dev->shutdown_lock); - - if (shutdown) - nvme_pci_remove_dmabuf(&dev->dmabufs); } static int nvme_disable_prepare_reset(struct nvme_dev *dev, bool shutdown) @@ -4150,6 +4147,7 @@ static void nvme_remove(struct pci_dev *pdev) nvme_stop_ctrl(&dev->ctrl); nvme_remove_namespaces(&dev->ctrl); nvme_dev_disable(dev, true); + nvme_pci_remove_dmabuf(&dev->dmabufs); nvme_free_host_mem(dev); nvme_dev_remove_admin(dev); nvme_dbbuf_dma_free(dev);