diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-02-01 14:39:04 +0100 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-11-04 20:52:53 +0100 |
commit | 3f85d50b609e8a5ef151656210203a6e94c19538 (patch) | |
tree | af6de7b2682ffe778146b1d77076c6610fde8f72 | |
parent | NVMe: Remove 'node' from nvme_dev (diff) | |
download | linux-3f85d50b609e8a5ef151656210203a6e94c19538.tar.xz linux-3f85d50b609e8a5ef151656210203a6e94c19538.zip |
NVMe: Check returns from nvme_alloc_queue()
It can return NULL, so handle that.
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
-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, 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; @@ -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; |