fix ifnullfree.cocci warnings
diff mbox

Message ID 20150922175426.GA62109@xian
State New
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 <>
Signed-off-by: Fengguang Wu <>

 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
More majordomo info at

diff mbox

--- 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