Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754740AbbKXLDP (ORCPT ); Tue, 24 Nov 2015 06:03:15 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:38381 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754490AbbKXLBM (ORCPT ); Tue, 24 Nov 2015 06:01:12 -0500 Message-ID: <56544376.1050801@lightnvm.io> Date: Tue, 24 Nov 2015 12:01:10 +0100 From: =?windows-1252?Q?Matias_Bj=F8rling?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Sudip Mukherjee CC: linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/5] lightnvm: create dma pool first References: <1448361300-26718-1-git-send-email-sudipm.mukherjee@gmail.com> <1448361300-26718-3-git-send-email-sudipm.mukherjee@gmail.com> In-Reply-To: <1448361300-26718-3-git-send-email-sudipm.mukherjee@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1440 Lines: 44 On 11/24/2015 11:34 AM, Sudip Mukherjee wrote: > If create_dma_pool() fails then we are returning the error code but we > have already added the device to the list. Lets add the device to the > list only if everything is successfully initialized. > > Signed-off-by: Sudip Mukherjee > --- > drivers/lightnvm/core.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c > index 2ab561f..d288996 100644 > --- a/drivers/lightnvm/core.c > +++ b/drivers/lightnvm/core.c > @@ -313,10 +313,6 @@ int nvm_register(struct request_queue *q, char *disk_name, > if (ret) > goto err_init; > > - down_write(&nvm_lock); > - list_add(&dev->devices, &nvm_devices); > - up_write(&nvm_lock); > - > if (dev->ops->max_phys_sect > 1) { > dev->ppalist_pool = dev->ops->create_dma_pool(dev->q, > "ppalist"); > @@ -326,6 +322,10 @@ int nvm_register(struct request_queue *q, char *disk_name, > } > } > > + down_write(&nvm_lock); > + list_add(&dev->devices, &nvm_devices); > + up_write(&nvm_lock); > + > return 0; > err_init: > kfree(dev); > Thanks. This have already been fixed. -- 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/