btrfs: remove redundant NULL check before kvfree
authorYang Li <abaci-bugfix@linux.alibaba.com>
Thu, 21 Jan 2021 08:19:47 +0000 (16:19 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Feb 2021 21:58:52 +0000 (22:58 +0100)
Fix below warnings reported by coccicheck:
./fs/btrfs/raid56.c:237:2-8: WARNING: NULL check before some freeing
functions is not needed.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Yang Li <abaci-bugfix@linux.alibaba.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid56.c

index 93fbf87bdc8d3b0ab9070763c9bfdaa519f936a5..5394641541f7a6f862a955ddc51b49fa66bf351e 100644 (file)
@@ -233,8 +233,7 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info)
        }
 
        x = cmpxchg(&info->stripe_hash_table, NULL, table);
-       if (x)
-               kvfree(x);
+       kvfree(x);
        return 0;
 }