diff mbox

fix ifnullfree.cocci warnings

Message ID 20150922175426.GA62109@xian (mailing list archive)
State New, archived
Headers show

Commit Message

Fengguang Wu Sept. 22, 2015, 5:54 p.m. UTC
fs/btrfs/qgroup.c:1463: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: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1459,8 +1459,7 @@  struct btrfs_qgroup_extent_record *btrfs
 
 void btrfs_qgroup_free_extent_record(struct btrfs_qgroup_extent_record *record)
 {
-	if (record)
-		kfree(record);
+	kfree(record);
 }
 
 struct btrfs_qgroup_extent_record