[PATCH] nvme-pci : rectifying the nvme_probe teardown path

From: Irvin Cote
Date: Wed Feb 08 2023 - 09:38:39 EST


Fixes: eac3ef262941 ("nvme-pci: split the initial probe from the rest path")
Signed-off-by: Irvin Cote <irvin.cote@xxxxxxxxxxxx>
---
drivers/nvme/host/pci.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index c734934c407c..db480bc64c7b 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2731,6 +2731,7 @@ static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl)
struct nvme_dev *dev = to_nvme_dev(ctrl);

nvme_free_tagset(dev);
+ nvme_uninit_ctrl(ctrl);
put_device(dev->dev);
kfree(dev->queues);
kfree(dev);
@@ -3036,7 +3037,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)

result = nvme_dev_map(dev);
if (result)
- goto out_uninit_ctrl;
+ goto out_unalloc_dev;

result = nvme_setup_prp_pools(dev);
if (result)
@@ -3118,8 +3119,8 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
nvme_release_prp_pools(dev);
out_dev_unmap:
nvme_dev_unmap(dev);
-out_uninit_ctrl:
- nvme_uninit_ctrl(&dev->ctrl);
+out_unalloc_dev:
+ nvme_pci_free_ctrl(&dev->ctrl);
return result;
}

--
2.37.2