Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752494AbbBKJeT (ORCPT ); Wed, 11 Feb 2015 04:34:19 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:49174 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbbBKJeP (ORCPT ); Wed, 11 Feb 2015 04:34:15 -0500 X-IronPort-AV: E=Sophos;i="5.09,557,1418079600"; d="scan'208";a="99657660" Date: Wed, 11 Feb 2015 10:34:07 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Bas Peters cc: clm@fb.com, jbacik@fb.com, dsterba@suse.cz, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] fs: btrfs: free-space-cache.c: remove two unnecessary checks before calling kfree() In-Reply-To: <1423646233-16637-1-git-send-email-baspeters93@gmail.com> Message-ID: References: <1423646233-16637-1-git-send-email-baspeters93@gmail.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1432 Lines: 56 On Wed, 11 Feb 2015, Bas Peters wrote: > kfree checks whether the pointer it is passed is NULL. The two foregoing > checks are therefore unnecessary. > > This issue was detected using Coccinelle. > > Signed-off-by: Bas Peters > --- > fs/btrfs/free-space-cache.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c > index d6c03f7..7d2d817 100644 > --- a/fs/btrfs/free-space-cache.c > +++ b/fs/btrfs/free-space-cache.c > @@ -1976,8 +1976,7 @@ new_bitmap: > > out: > if (info) { > - if (info->bitmap) > - kfree(info->bitmap); > + kfree(info->bitmap); > kmem_cache_free(btrfs_free_space_cachep, info); > } > > @@ -3427,8 +3426,7 @@ again: > > if (info) > kmem_cache_free(btrfs_free_space_cachep, info); > - if (map) > - kfree(map); > + kfree(map); A certain lack of parallelism arises in the latter case. julia > return 0; > } > > -- > 2.1.0 > > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- 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/