block:Change the function, nvme_alloc_queue to use -ENOMEM for when failing memory allocations
Subsystems (2)
PATCH 1/1 block:Change the function, nvme_alloc_queue to use -ENOMEM for when failing memory allocations
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.
--- drivers/block/nvme-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nvme-core.c +1 -1
@@ -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 );
Signature · 1 line
2.1.4
Re: [PATCH] block:Change the function,nvme_alloc_queue to use -ENOMEM for when failing memory allocations
drivers/block/nvme-core.c static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid, · line 1390
Quoted 9 lines · Nicholas Krause
This changes the function,nvme_alloc_queue to use the kernel code,
-ENOMEMfor when failing to allocate the memory required for thenvme_queuestructure pointer,nvme in order to correctly return to the caller the correct reason for this function's failing.drivers/block/nvme-core.c +1
-1if (!nvmeq) -return NULL ; +return -ENOMEM ;
You didn't even compile-test this, did you?
Quoted 4 lines · Nicholas Krause
This changes the function,nvme_alloc_queue to use the kernel code,
-ENOMEMfor when failing to allocate the memory required for thenvme_queuestructure pointer,nvme in order to correctly return to the caller the correct reason for this function's failing.
Nak! Look at what the callers are checking for upon return.
Quoted 18 lines
Signed-off-by Nicholas Krause <xerofoify at gmail.com>---
drivers/block/nvme-core.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/nvme-core.c +1
-1@@ -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 );