Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block:Change the function, nvme_alloc_queue to use -ENOMEM for when failing memory allocations
@ 2015-05-12 23:51 Nicholas Krause
  2015-05-13 13:32 ` [PATCH] block:Change the function,nvme_alloc_queue " Matthew Wilcox
  2015-05-13 14:12 ` [PATCH] block:Change the function, nvme_alloc_queue " Keith Busch
  0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Krause @ 2015-05-12 23:51 UTC (permalink / raw)


This changes the function,nvme_alloc_queue to use the kernel code,
-ENOMEM for when failing to allocate the memory required for the
nvme_queue structure pointer,nvme in order to correctly return
to the caller the correct reason for this function's failing.

Signed-off-by: Nicholas Krause <xerofoify at gmail.com>
---
 drivers/block/nvme-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 85b8036..e2eac1e 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -1387,7 +1387,7 @@ static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid,
 	struct device *dmadev = &dev->pci_dev->dev;
 	struct nvme_queue *nvmeq = kzalloc(sizeof(*nvmeq), GFP_KERNEL);
 	if (!nvmeq)
-		return NULL;
+		return -ENOMEM;
 
 	nvmeq->cqes = dma_zalloc_coherent(dmadev, CQ_SIZE(depth),
 					  &nvmeq->cq_dma_addr, GFP_KERNEL);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-13 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12 23:51 [PATCH] block:Change the function, nvme_alloc_queue to use -ENOMEM for when failing memory allocations Nicholas Krause
2015-05-13 13:32 ` [PATCH] block:Change the function,nvme_alloc_queue " Matthew Wilcox
2015-05-13 14:12 ` [PATCH] block:Change the function, nvme_alloc_queue " Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox