ext2: Delete an unnecessary check before brelse()
diff mbox series

Message ID 51dea296-2207-ebc0-bac3-13f3e5c3b235@web.de
State New
Headers show
Series
  • ext2: Delete an unnecessary check before brelse()
Related show

Commit Message

Markus Elfring Sept. 3, 2019, 12:44 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 3 Sep 2019 14:40:18 +0200

The brelse() function tests whether its argument is NULL
and then returns immediately.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/ext2/super.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--
2.23.0

Comments

Jan Kara Sept. 4, 2019, 7:23 a.m. UTC | #1
On Tue 03-09-19 14:44:08, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 3 Sep 2019 14:40:18 +0200
> 
> The brelse() function tests whether its argument is NULL
> and then returns immediately.
> Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Thanks. Added to my tree.

								Honza

> ---
>  fs/ext2/super.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index baa36c6fb71e..30c630d73f0f 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -162,8 +162,7 @@ static void ext2_put_super (struct super_block * sb)
>  	}
>  	db_count = sbi->s_gdb_count;
>  	for (i = 0; i < db_count; i++)
> -		if (sbi->s_group_desc[i])
> -			brelse (sbi->s_group_desc[i]);
> +		brelse(sbi->s_group_desc[i]);
>  	kfree(sbi->s_group_desc);
>  	kfree(sbi->s_debts);
>  	percpu_counter_destroy(&sbi->s_freeblocks_counter);
> --
> 2.23.0
> 
>

Patch
diff mbox series

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index baa36c6fb71e..30c630d73f0f 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -162,8 +162,7 @@  static void ext2_put_super (struct super_block * sb)
 	}
 	db_count = sbi->s_gdb_count;
 	for (i = 0; i < db_count; i++)
-		if (sbi->s_group_desc[i])
-			brelse (sbi->s_group_desc[i]);
+		brelse(sbi->s_group_desc[i]);
 	kfree(sbi->s_group_desc);
 	kfree(sbi->s_debts);
 	percpu_counter_destroy(&sbi->s_freeblocks_counter);