From: Keith Busch Date: Mon, 3 Mar 2014 18:09:47 +0000 (-0700) Subject: NVMe: Initialize device reference count earlier X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fb35e914b3f88cda9ee6f9d776910c35269c4ecf;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Matthew Wilcox --- 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;