linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <fengguang.wu@intel.com>
To: Anand Jain <anand.jain@oracle.com>
Cc: kbuild-all@01.org, David Sterba <dsterba@suse.com>,
	"Chris Mason <chris.mason@fusionio.com> Chris Mason" <clm@fb.com>,
	Josef Bacik <jbacik@fb.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] btrfs: fix ifnullfree.cocci warnings
Date: Wed, 17 Feb 2016 19:04:41 +0800	[thread overview]
Message-ID: <20160217110441.GA21406@lkp-sb04> (raw)
In-Reply-To: <201602171939.Xe24Ni6m%fengguang.wu@intel.com>

fs/btrfs/volumes.c:1886:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 volumes.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1882,8 +1882,7 @@ int btrfs_rm_device(struct btrfs_root *r
 	}
 
 out:
-	if (dev_name)
-		kfree(dev_name);
+	kfree(dev_name);
 
 	mutex_unlock(&uuid_mutex);
 	return ret;

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201602171939.Xe24Ni6m%fengguang.wu@intel.com>
2016-02-17 11:04 ` kbuild test robot [this message]
2016-02-18  9:14   ` [PATCH] btrfs: fix ifnullfree.cocci warnings David Sterba

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=20160217110441.GA21406@lkp-sb04 \
    --to=fengguang.wu@intel.com \
    --cc=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=jbacik@fb.com \
    --cc=kbuild-all@01.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;
as well as URLs for NNTP newsgroup(s).