Skip to contentSkip to conversation

NVMe: Initialize device reference count earlier

PATCH New Keith Busch 1 participant 1 message Sep 9, 2015 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NVMe: Initialize device reference count earlier

commit fb35e914b3f88cda9ee6f9d776910c35269c4ecf 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.

---
 drivers/block/nvme-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nvme-core.c +1 -1
index 87dd4c7..f565212 100644
@@ -2464,6 +2464,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (result)
 		goto release;
 
+	kref_init(&dev->kref);
 	result = nvme_dev_start(dev);
 	if (result) {
 		if (result == -EBUSY)
@@ -2471,7 +2472,6 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		goto release_pools;
 	}
 
-	kref_init(&dev->kref);
 	result = nvme_dev_add(dev);
 	if (result)
 		goto shutdown;
Signature · 1 line
1.7.10.4