Skip to contentSkip to conversation

ext4: remove useless conditional branch code

PATCH Applied wuchi 3 participants 3 messages Apr 1, 2023 – Apr 20, 2023 ext4 file system

lore
Share & tools
lore

wuchi

author
#0 lore raw

PATCH 1/1 ext4: remove useless conditional branch code

It's ok because the code will be optimized by the compiler, just try to simple the code.

---
 fs/ext4/bitmap.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/ext4/bitmap.c +1 -4
index 87c1c8ae9298..cd725bebe69e 100644
@@ -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,
Signature · 1 line
2.20.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · wuchi

It's ok because the code will be optimized by the compiler, just try to simple the code.

Sure. Feel free to add:

Honza

Quoted 20 lines
fs/ext4/bitmap.c +1 -4
index 87c1c8ae9298..cd725bebe69e 100644
@@ -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,
Signature · 1 line
2.20.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#2 lore raw
In reply to wuchi
Quoted 4 lines · wuchi

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,

Signature · 1 line
Theodore Ts'o <[email protected]>