[PATCH] jfs: Use more common error handling code in jfs_readdir()

Markus Elfring <[email protected]> Tue, 16 Jun 2026 20:00:24 +0200
Newsgroups org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: Markus Elfring <[email protected]>
Date: Tue, 16 Jun 2026 19:50:07 +0200

Use an existing label once more so that a bit of exception handling can be
better reused at the end of this function implementation.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---
 fs/jfs/jfs_dtree.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index 8ce6e4458cc2..f0efdffb9e5c 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -3036,10 +3036,8 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
 		}
 
 		DT_GETPAGE(ip, bn, mp, PSIZE, p, rc);
-		if (rc) {
-			kfree(dirent_buf);
-			return rc;
-		}
+		if (rc)
+			goto out;
 	}
 
       out:
-- 
2.54.0