]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
btrfs: fix ifnullfree.cocci warnings
authorkbuild test robot <fengguang.wu@intel.com>
Wed, 17 Feb 2016 11:04:41 +0000 (19:04 +0800)
committerDavid Sterba <dsterba@suse.com>
Fri, 26 Feb 2016 14:04:55 +0000 (15:04 +0100)
fs/btrfs/volumes.c:1886: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: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index 05d9bc0cdd4954f550ed2ea18b4e756fe6345d98..ceacd9dca9c015373487f45f51ed12fec7a73fba 100644 (file)
@@ -1898,8 +1898,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path, u64 devid)
        }
 
 out:
-       if (dev_name)
-               kfree(dev_name);
+       kfree(dev_name);
 
        mutex_unlock(&uuid_mutex);
        return ret;