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

From: Markus Elfring

Date: Tue Jun 16 2026 - 14:00:46 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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 <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
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