]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
NVMe: Initialize device reference count earlier
authorKeith Busch <keith.busch@intel.com>
Mon, 3 Mar 2014 18:09:47 +0000 (11:09 -0700)
committerMatthew Wilcox <matthew.r.wilcox@intel.com>
Mon, 24 Mar 2014 12:15:14 +0000 (08:15 -0400)
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: Keith Busch <keith.busch@intel.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
drivers/block/nvme-core.c

index 87dd4c79e65ff2131534a75fb56e51493e3528ae..f565212a9e32caff3f2145433b85b5af4d836ea2 100644 (file)
@@ -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;