summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2014-03-03 19:09:47 +0100
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2014-03-24 13:15:14 +0100
commitfb35e914b3f88cda9ee6f9d776910c35269c4ecf (patch)
tree0bca372b7e76d285f3ac63429743930659c69c32 /drivers
parentNVMe: Add CONFIG_PM_SLEEP to suspend/resume functions (diff)
downloadlinux-fb35e914b3f88cda9ee6f9d776910c35269c4ecf.tar.xz
linux-fb35e914b3f88cda9ee6f9d776910c35269c4ecf.zip
NVMe: Initialize device reference count earlier
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/nvme-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 87dd4c79e65f..f565212a9e32 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -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;