diff mbox series

btrfs: remove redundant NULL check

Message ID 1611217187-50142-1-git-send-email-abaci-bugfix@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series btrfs: remove redundant NULL check | expand

Commit Message

Abaci Team Jan. 21, 2021, 8:19 a.m. UTC
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>
Signed-off-by: Yang Li <abaci-bugfix@linux.alibaba.com>
---
 fs/btrfs/raid56.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Anand Jain Jan. 21, 2021, 10:29 a.m. UTC | #1
On 21/1/21 4:19 pm, Yang Li wrote:
> 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>
> Signed-off-by: Yang Li <abaci-bugfix@linux.alibaba.com>
> ---
>   fs/btrfs/raid56.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> index 93fbf87..5394641 100644
> --- a/fs/btrfs/raid56.c
> +++ b/fs/btrfs/raid56.c
> @@ -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);



  Reviewed-by: Anand Jain <anand.jain@oracle.com>

Thanks, Anand


>   	return 0;
>   }
>   
>
David Sterba Jan. 21, 2021, 4:35 p.m. UTC | #2
On Thu, Jan 21, 2021 at 04:19:47PM +0800, Yang Li wrote:
> 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>
> Signed-off-by: Yang Li <abaci-bugfix@linux.alibaba.com>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 93fbf87..5394641 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -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;
 }