diff mbox series

[3/3] ext4: Remove some dead code in the error handling path of ext4_mb_init_cache()

Message ID 282d130abca6fe7db5edef1922c971849397ffa9.1735912719.git.christophe.jaillet@wanadoo.fr
State New
Headers show
Series [1/3] ext4: Fix an error handling path in ext4_mb_init_cache() | expand

Commit Message

Christophe JAILLET Jan. 3, 2025, 1:59 p.m. UTC
'bh' is known to be a non-NULL value if the error handling path is called,
so there is no need to test for it.

This slighly simplifies the code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 fs/ext4/mballoc.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Markus Elfring Jan. 6, 2025, 2:20 p.m. UTC | #1
> This slighly simplifies the code.

Simplify the source code slightly?

Regards,
Markus
diff mbox series

Patch

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index e536c0e35ca8..c22f7b8fd941 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1430,12 +1430,11 @@  static int ext4_mb_init_cache(struct folio *folio, char *incore, gfp_t gfp)
 	folio_mark_uptodate(folio);
 
 out:
-	if (bh) {
-		for (i = 0; i < groups_per_page; i++)
-			brelse(bh[i]);
-		if (bh != &bhs)
-			kfree(bh);
-	}
+	for (i = 0; i < groups_per_page; i++)
+		brelse(bh[i]);
+	if (bh != &bhs)
+		kfree(bh);
+
 	return err;
 }