[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160102114951.GA37337@lkp-hsx03.intel.com>
Date: Sat, 2 Jan 2016 19:49:51 +0800
From: kbuild test robot <lkp@...el.com>
To: Markus Pargmann <mpa@...gutronix.de>
Cc: kbuild-all@...org, Jens Axboe <axboe@...nel.dk>,
linux-kernel@...r.kernel.org, nbd-general@...ts.sourceforge.net,
kernel@...gutronix.de, Markus Pargmann <mpa@...gutronix.de>
Subject: [PATCH] nbd: fix ifnullfree.cocci warnings
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@...gutronix.de>
Signed-off-by: Fengguang Wu <fengguang.wu@...el.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) */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists