diff mbox series

ext2: remove redundant condition check

Message ID 20181113232353.11011-1-cgxu519@gmx.com
State Not Applicable
Headers show
Series ext2: remove redundant condition check | expand

Commit Message

cgxu519 Nov. 13, 2018, 11:23 p.m. UTC
ext2_xattr_destroy_cache() can handle NULL pointer correctly,
so there is no need to check NULL pointer before calling
ext2_xattr_destroy_cache().

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 fs/ext2/super.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Jan Kara Nov. 14, 2018, 12:15 p.m. UTC | #1
On Wed 14-11-18 07:23:53, Chengguang Xu wrote:
> ext2_xattr_destroy_cache() can handle NULL pointer correctly,
> so there is no need to check NULL pointer before calling
> ext2_xattr_destroy_cache().
> 
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>

Looks good. Applied. Thanks for the patch.

							Honza

> ---
>  fs/ext2/super.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index cb91baa4275d..e4351c280608 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -148,10 +148,9 @@ static void ext2_put_super (struct super_block * sb)
>  
>  	ext2_quota_off_umount(sb);
>  
> -	if (sbi->s_ea_block_cache) {
> -		ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
> -		sbi->s_ea_block_cache = NULL;
> -	}
> +	ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
> +	sbi->s_ea_block_cache = NULL;
> +
>  	if (!sb_rdonly(sb)) {
>  		struct ext2_super_block *es = sbi->s_es;
>  
> @@ -1197,8 +1196,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  			sb->s_id);
>  	goto failed_mount;
>  failed_mount3:
> -	if (sbi->s_ea_block_cache)
> -		ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
> +	ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
>  	percpu_counter_destroy(&sbi->s_freeblocks_counter);
>  	percpu_counter_destroy(&sbi->s_freeinodes_counter);
>  	percpu_counter_destroy(&sbi->s_dirs_counter);
> -- 
> 2.17.2
> 
>
diff mbox series

Patch

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index cb91baa4275d..e4351c280608 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -148,10 +148,9 @@  static void ext2_put_super (struct super_block * sb)
 
 	ext2_quota_off_umount(sb);
 
-	if (sbi->s_ea_block_cache) {
-		ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
-		sbi->s_ea_block_cache = NULL;
-	}
+	ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
+	sbi->s_ea_block_cache = NULL;
+
 	if (!sb_rdonly(sb)) {
 		struct ext2_super_block *es = sbi->s_es;
 
@@ -1197,8 +1196,7 @@  static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 			sb->s_id);
 	goto failed_mount;
 failed_mount3:
-	if (sbi->s_ea_block_cache)
-		ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
+	ext2_xattr_destroy_cache(sbi->s_ea_block_cache);
 	percpu_counter_destroy(&sbi->s_freeblocks_counter);
 	percpu_counter_destroy(&sbi->s_freeinodes_counter);
 	percpu_counter_destroy(&sbi->s_dirs_counter);