aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2013-12-16 13:50:00 -0500
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2014-01-27 20:11:38 -0500
commita1a5ef9998b1379780790b878457b0e0f48b25db (patch)
treed8690fc85404d9e24c746e2657873de234bf6e94 /drivers/block
parent469071a37afc8a627b6b2ddf29db0a097d864845 (diff)
NVMe: Disable admin queue on init failure
Disable the admin queue if device fails during initialization so the queue's irq is freed. Signed-off-by: Keith Busch <keith.busch@intel.com> [rewritten to use nvme_free_queues] Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nvme-core.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 7b615a063e92..89021d710ec2 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -1152,11 +1152,11 @@ static void nvme_free_queue(struct nvme_queue *nvmeq)
1152 kfree(nvmeq); 1152 kfree(nvmeq);
1153} 1153}
1154 1154
1155static void nvme_free_queues(struct nvme_dev *dev) 1155static void nvme_free_queues(struct nvme_dev *dev, int lowest)
1156{ 1156{
1157 int i; 1157 int i;
1158 1158
1159 for (i = dev->queue_count - 1; i >= 0; i--) { 1159 for (i = dev->queue_count - 1; i >= lowest; i--) {
1160 nvme_free_queue(dev->queues[i]); 1160 nvme_free_queue(dev->queues[i]);
1161 dev->queue_count--; 1161 dev->queue_count--;
1162 dev->queues[i] = NULL; 1162 dev->queues[i] = NULL;
@@ -1991,7 +1991,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
1991 return 0; 1991 return 0;
1992 1992
1993 free_queues: 1993 free_queues:
1994 nvme_free_queues(dev); 1994 nvme_free_queues(dev, 1);
1995 return result; 1995 return result;
1996} 1996}
1997 1997
@@ -2411,6 +2411,7 @@ static int nvme_dev_start(struct nvme_dev *dev)
2411 return result; 2411 return result;
2412 2412
2413 disable: 2413 disable:
2414 nvme_disable_queue(dev, 0);
2414 spin_lock(&dev_list_lock); 2415 spin_lock(&dev_list_lock);
2415 list_del_init(&dev->node); 2416 list_del_init(&dev->node);
2416 spin_unlock(&dev_list_lock); 2417 spin_unlock(&dev_list_lock);
@@ -2542,7 +2543,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2542 shutdown: 2543 shutdown:
2543 nvme_dev_shutdown(dev); 2544 nvme_dev_shutdown(dev);
2544 release_pools: 2545 release_pools:
2545 nvme_free_queues(dev); 2546 nvme_free_queues(dev, 0);
2546 nvme_release_prp_pools(dev); 2547 nvme_release_prp_pools(dev);
2547 release: 2548 release:
2548 nvme_release_instance(dev); 2549 nvme_release_instance(dev);
@@ -2566,7 +2567,7 @@ static void nvme_remove(struct pci_dev *pdev)
2566 misc_deregister(&dev->miscdev); 2567 misc_deregister(&dev->miscdev);
2567 nvme_dev_remove(dev); 2568 nvme_dev_remove(dev);
2568 nvme_dev_shutdown(dev); 2569 nvme_dev_shutdown(dev);
2569 nvme_free_queues(dev); 2570 nvme_free_queues(dev, 0);
2570 nvme_release_instance(dev); 2571 nvme_release_instance(dev);
2571 nvme_release_prp_pools(dev); 2572 nvme_release_prp_pools(dev);
2572 kref_put(&dev->kref, nvme_free_dev); 2573 kref_put(&dev->kref, nvme_free_dev);