public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bas Peters <baspeters93@gmail.com>
To: clm@fb.com, jbacik@fb.com, dsterba@suse.cz
Cc: Bas Peters <baspeters93@gmail.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH] fs: btrfs: free-space-cache.c: remove two unnecessary checks before calling kfree()
Date: Wed, 11 Feb 2015 10:17:13 +0100	[thread overview]
Message-ID: <1423646233-16637-1-git-send-email-baspeters93@gmail.com> (raw)

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);
 	return 0;
 }
 
-- 
2.1.0


             reply	other threads:[~2015-02-11  9:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11  9:17 Bas Peters [this message]
2015-02-11  9:34 ` [PATCH] fs: btrfs: free-space-cache.c: remove two unnecessary checks before calling kfree() Julia Lawall
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=1423646233-16637-1-git-send-email-baspeters93@gmail.com \
    --to=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