NVMe: Check returns from nvme_alloc_queue()

It can return NULL, so handle that.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index 9377cf3..dc82177 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -619,6 +619,9 @@
 	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 @@
 	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;