From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755615AbcIRJUG (ORCPT ); Sun, 18 Sep 2016 05:20:06 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:43703 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755439AbcIRJT6 (ORCPT ); Sun, 18 Sep 2016 05:19:58 -0400 Subject: Re: Question about commit f9a67b1182e5 ("md/bitmap: clear bitmap if bitmap_create failed"). To: Marion & Christophe JAILLET , Shaohua Li References: <752ab1d9-412a-149b-a241-e604040ebaff@wanadoo.fr> <20160913172433.GB24264@kernel.org> <57D9097C.5050202@suse.com> <5e0b941c-1536-3242-eb26-a500e5bb4ff6@wanadoo.fr> Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org From: Guoqing Jiang Message-ID: <57DE5C2E.6040903@suse.com> Date: Sun, 18 Sep 2016 05:19:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5e0b941c-1536-3242-eb26-a500e5bb4ff6@wanadoo.fr> 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 On 09/14/2016 04:39 PM, Marion & Christophe JAILLET wrote: > > I don't share your feeling. > bitmap_create() can return ERR_PTR(-ENOMEM) or ERR_PTR(-EINVAL). > > In such cases 'if (!bitmap)' will not be helpful. > > Maybe it should be turned into 'if (IS_ERR_OR_NULL(bitmap))' to handle > errors returned by bitmap_create. > Maybe just removing the call to 'bitmap_free(bitmap)' is enough. > I agreed we can remove it, if so, seems we are not consistent with the previous comment of bitmap_create. /* * initialize the bitmap structure * if this returns an error, bitmap_destroy must be called to do clean up */ What about revert it and re-use v1 patch? see http://www.spinics.net/lists/raid/msg51819.html. Thanks, Guoqing