lkml.org 
[lkml]   [2015]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] block:Change the function, nvme_alloc_queue to use -ENOMEM for when failing memory allocations
On Tue, 12 May 2015, Nicholas Krause wrote:
> 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.

Nak! Look at what the callers are checking for upon return.

> Signed-off-by: Nicholas Krause <xerofoify@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);


\
 
 \ /
  Last update: 2015-05-13 16:21    [W:0.035 / U:1.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site