diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-02-01 08:39:04 -0500 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-11-04 15:52:53 -0400 |
commit | 3f85d50b609e8a5ef151656210203a6e94c19538 (patch) | |
tree | af6de7b2682ffe778146b1d77076c6610fde8f72 /drivers/block/nvme.c | |
parent | 8e9f0e71150bf6277d0ea40bc8feb1338ddf13fd (diff) |
NVMe: Check returns from nvme_alloc_queue()
It can return NULL, so handle that.
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme.c')
-rw-r--r-- | drivers/block/nvme.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c index 9377cf32f813..dc821776be94 100644 --- a/drivers/block/nvme.c +++ b/drivers/block/nvme.c | |||
@@ -619,6 +619,9 @@ static __devinit struct nvme_queue *nvme_create_queue(struct nvme_dev *dev, | |||
619 | int result; | 619 | int result; |
620 | struct nvme_queue *nvmeq = nvme_alloc_queue(dev, qid, cq_size, vector); | 620 | struct nvme_queue *nvmeq = nvme_alloc_queue(dev, qid, cq_size, vector); |
621 | 621 | ||
622 | if (!nvmeq) | ||
623 | return NULL; | ||
624 | |||
622 | result = adapter_alloc_cq(dev, qid, nvmeq); | 625 | result = adapter_alloc_cq(dev, qid, nvmeq); |
623 | if (result < 0) | 626 | if (result < 0) |
624 | goto free_nvmeq; | 627 | goto free_nvmeq; |
@@ -655,6 +658,8 @@ static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev) | |||
655 | dev->dbs = ((void __iomem *)dev->bar) + 4096; | 658 | dev->dbs = ((void __iomem *)dev->bar) + 4096; |
656 | 659 | ||
657 | nvmeq = nvme_alloc_queue(dev, 0, 64, 0); | 660 | nvmeq = nvme_alloc_queue(dev, 0, 64, 0); |
661 | if (!nvmeq) | ||
662 | return -ENOMEM; | ||
658 | 663 | ||
659 | aqa = nvmeq->q_depth - 1; | 664 | aqa = nvmeq->q_depth - 1; |
660 | aqa |= aqa << 16; | 665 | aqa |= aqa << 16; |