Commit 184e1198 authored by Keith Busch's avatar Keith Busch Committed by Greg Kroah-Hartman

NVMe: Initialize device reference count earlier

commit fb35e914 upstream.

If an NVMe device becomes ready but fails to create IO queues, the driver
creates a character device handle so the device can be managed. The
device reference count needs to be initialized before creating the
character device.
Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
Signed-off-by: default avatarMatthew Wilcox <matthew.r.wilcox@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 34820fc8
...@@ -2464,6 +2464,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -2464,6 +2464,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (result) if (result)
goto release; goto release;
kref_init(&dev->kref);
result = nvme_dev_start(dev); result = nvme_dev_start(dev);
if (result) { if (result) {
if (result == -EBUSY) if (result == -EBUSY)
...@@ -2471,7 +2472,6 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -2471,7 +2472,6 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto release_pools; goto release_pools;
} }
kref_init(&dev->kref);
result = nvme_dev_add(dev); result = nvme_dev_add(dev);
if (result) if (result)
goto shutdown; goto shutdown;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment