diff mbox series

ext4: remove useless conditional branch code

Message ID 20230401075303.45206-1-wuchi.zero@gmail.com
State Awaiting Upstream
Headers show
Series ext4: remove useless conditional branch code | expand

Commit Message

wuchi April 1, 2023, 7:53 a.m. UTC
It's ok because the code will be optimized by the compiler, just
try to simple the code.

Signed-off-by: wuchi <wuchi.zero@gmail.com>
---
 fs/ext4/bitmap.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Jan Kara April 14, 2023, 4:55 p.m. UTC | #1
On Sat 01-04-23 15:53:03, wuchi wrote:
> It's ok because the code will be optimized by the compiler, just
> try to simple the code.
> 
> Signed-off-by: wuchi <wuchi.zero@gmail.com>

Sure. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
> 
> diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
> index 87c1c8ae9298..cd725bebe69e 100644
> --- a/fs/ext4/bitmap.c
> +++ b/fs/ext4/bitmap.c
> @@ -74,10 +74,7 @@ int ext4_block_bitmap_csum_verify(struct super_block *sb,
>  	} else
>  		calculated &= 0xFFFF;
>  
> -	if (provided == calculated)
> -		return 1;
> -
> -	return 0;
> +	return provided == calculated;
>  }
>  
>  void ext4_block_bitmap_csum_set(struct super_block *sb,
> -- 
> 2.20.1
>
Theodore Ts'o April 20, 2023, 1:47 p.m. UTC | #2
On Sat, 01 Apr 2023 15:53:03 +0800, wuchi wrote:
> It's ok because the code will be optimized by the compiler, just
> try to simple the code.
> 
> 

Applied, thanks!

[1/1] ext4: remove useless conditional branch code
      commit: 17809d3cf801374d7c23101800770ea34951f3c8

Best regards,
diff mbox series

Patch

diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index 87c1c8ae9298..cd725bebe69e 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -74,10 +74,7 @@  int ext4_block_bitmap_csum_verify(struct super_block *sb,
 	} else
 		calculated &= 0xFFFF;
 
-	if (provided == calculated)
-		return 1;
-
-	return 0;
+	return provided == calculated;
 }
 
 void ext4_block_bitmap_csum_set(struct super_block *sb,