Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965320AbbEMOMO (ORCPT ); Wed, 13 May 2015 10:12:14 -0400 Received: from mga03.intel.com ([134.134.136.65]:14115 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934415AbbEMOML (ORCPT ); Wed, 13 May 2015 10:12:11 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,421,1427785200"; d="scan'208";a="728559905" Date: Wed, 13 May 2015 14:12:10 +0000 (UTC) From: Keith Busch X-X-Sender: vmware@localhost.lm.intel.com To: Nicholas Krause cc: willy@linux.intel.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Subject: Re: [PATCH] block:Change the function, nvme_alloc_queue to use -ENOMEM for when failing memory allocations In-Reply-To: <1431474691-30469-1-git-send-email-xerofoify@gmail.com> Message-ID: References: <1431474691-30469-1-git-send-email-xerofoify@gmail.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1303 Lines: 31 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 > --- > 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/