linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Markus Pargmann <mpa@pengutronix.de>
Cc: kbuild-all@01.org, Jens Axboe <axboe@kernel.dk>,
	linux-kernel@vger.kernel.org, nbd-general@lists.sourceforge.net,
	kernel@pengutronix.de, Markus Pargmann <mpa@pengutronix.de>
Subject: [PATCH] nbd: fix ifnullfree.cocci warnings
Date: Sat, 2 Jan 2016 19:49:51 +0800	[thread overview]
Message-ID: <20160102114951.GA37337@lkp-hsx03.intel.com> (raw)
In-Reply-To: <1451729825-11481-2-git-send-email-mpa@pengutronix.de>

drivers/block/nbd.c:937:2-26: 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.
drivers/block/nbd.c:918:2-26: 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: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 nbd.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -914,8 +914,7 @@ static int nbd_dev_dbg_init(struct nbd_d
 
 static void nbd_dev_dbg_close(struct nbd_device *nbd)
 {
-	if (nbd->dbg_dir)
-		debugfs_remove_recursive(nbd->dbg_dir);
+	debugfs_remove_recursive(nbd->dbg_dir);
 }
 
 static int nbd_dbg_init(void)
@@ -933,8 +932,7 @@ static int nbd_dbg_init(void)
 
 static void nbd_dbg_close(void)
 {
-	if (nbd_dbg_dir)
-		debugfs_remove_recursive(nbd_dbg_dir);
+	debugfs_remove_recursive(nbd_dbg_dir);
 }
 
 #else  /* IS_ENABLED(CONFIG_DEBUG_FS) */

  parent reply	other threads:[~2016-01-02 11:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-02 10:17 [PULL] NBD changes Markus Pargmann
2016-01-02 10:17 ` [PATCH 1/5] nbd: Fix debugfs error handling Markus Pargmann
2016-01-02 11:49   ` kbuild test robot
2016-01-02 11:49   ` kbuild test robot [this message]
2016-01-02 10:17 ` [PATCH 2/5] nbd: Remove signal usage Markus Pargmann
2016-01-03 11:56   ` Christoph Hellwig
2016-01-02 10:17 ` [PATCH 3/5] nbd: Timeouts are not user requested disconnects Markus Pargmann
2016-01-02 10:17 ` [PATCH 4/5] nbd: Cleanup reset of nbd and bdev after a disconnect Markus Pargmann
2016-01-02 10:17 ` [PATCH 5/5] nbd: Move flag parsing to a function Markus Pargmann

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=20160102114951.GA37337@lkp-hsx03.intel.com \
    --to=lkp@intel.com \
    --cc=axboe@kernel.dk \
    --cc=kbuild-all@01.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpa@pengutronix.de \
    --cc=nbd-general@lists.sourceforge.net \
    /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).