From: Julia Lawall <julia.lawall@lip6.fr>
To: Bas Peters <baspeters93@gmail.com>
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()
Date: Wed, 11 Feb 2015 10:34:07 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.10.1502111033450.2356@hadrien> (raw)
In-Reply-To: <1423646233-16637-1-git-send-email-baspeters93@gmail.com>
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 <baspeters93@gmail.com>
> ---
> 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
>
next prev parent reply other threads:[~2015-02-11 9:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 9:17 Bas Peters
2015-02-11 9:34 ` Julia Lawall [this message]
2015-02-11 11:30 ` SF Markus Elfring
2015-02-11 11:49 ` Bas Peters
2015-02-11 12:18 ` SF Markus Elfring
2015-02-11 12:19 ` Bas Peters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.10.1502111033450.2356@hadrien \
--to=julia.lawall@lip6.fr \
--cc=baspeters93@gmail.com \
--cc=clm@fb.com \
--cc=dsterba@suse.cz \
--cc=jbacik@fb.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®