Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] ext2: Delete an unnecessary check before brelse()
@ 2019-09-03 12:44 Markus Elfring
  2019-09-04  7:23 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2019-09-03 12:44 UTC (permalink / raw)
  To: linux-ext4, Jan Kara; +Cc: LKML, kernel-janitors

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(-)

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext2: Delete an unnecessary check before brelse()
  2019-09-03 12:44 [PATCH] ext2: Delete an unnecessary check before brelse() Markus Elfring
@ 2019-09-04  7:23 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2019-09-04  7:23 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Jan Kara, linux-ext4, kernel-janitors, LKML

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
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 12:44 [PATCH] ext2: Delete an unnecessary check before brelse() Markus Elfring
2019-09-04  7:23 ` Jan Kara

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \
		linux-ext4@vger.kernel.org linux-ext4@archiver.kernel.org
	public-inbox-index linux-ext4


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-ext4


AGPL code for this site: git clone https://public-inbox.org/ public-inbox