[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 Signed-off-by: Fengguang Wu --- 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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[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 PargmannSigned-off-by: Fengguang Wu --- 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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/