Skip to content

Commit

Permalink
NVMe: Check returns from nvme_alloc_queue()
Browse files Browse the repository at this point in the history
It can return NULL, so handle that.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
  • Loading branch information
Matthew Wilcox committed Nov 4, 2011
1 parent 8e9f0e7 commit 3f85d50
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ static __devinit struct nvme_queue *nvme_create_queue(struct nvme_dev *dev,
int result;
struct nvme_queue *nvmeq = nvme_alloc_queue(dev, qid, cq_size, vector);

if (!nvmeq)
return NULL;

result = adapter_alloc_cq(dev, qid, nvmeq);
if (result < 0)
goto free_nvmeq;
Expand Down Expand Up @@ -655,6 +658,8 @@ static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev)
dev->dbs = ((void __iomem *)dev->bar) + 4096;

nvmeq = nvme_alloc_queue(dev, 0, 64, 0);
if (!nvmeq)
return -ENOMEM;

aqa = nvmeq->q_depth - 1;
aqa |= aqa << 16;
Expand Down

0 comments on commit 3f85d50

Please sign in to comment.