Re: [PATCH] ocfs2: remove unnecessary ret variable in ocfs2_calc_xattr_init()

From: Joseph Qi

Date: Mon Sep 07 2026 - 21:27:16 EST


Hi,
This has already been addressed by:
ed57836ff300 ocfs2: make ocfs2_calc_xattr_init() return void

Thanks,
Joseph

On 9/7/26 9:22 PM, Krystian Kaniewski wrote:
> Commit bd7c05fb4a47 ("ocfs2: fix circular locking dependency in
> ocfs2_init_acl()") removed the only code that could change ret in
> ocfs2_calc_xattr_init(). The variable is now always zero, so remove it
> and return zero directly.
>
> This fixes the reported Coccinelle warning without changing behavior.
>
> Fixes: bd7c05fb4a47 ("ocfs2: fix circular locking dependency in ocfs2_init_acl()")
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202609040247.8B3lmoqX-lkp@xxxxxxxxx/
> Signed-off-by: Krystian Kaniewski <krystianmkaniewski@xxxxxxxxx>
> ---
> fs/ocfs2/xattr.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
> index 35bcbb0ff607..ab3b645983c9 100644
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -640,7 +640,6 @@ int ocfs2_calc_xattr_init(struct inode *dir, umode_t mode,
> int *want_clusters, int *xattr_credits,
> int *want_meta, struct ocfs2_acl_state *acl_state)
> {
> - int ret = 0;
> struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
> int s_size = 0, a_size = 0, acl_len = 0, new_clusters;
>
> @@ -662,7 +661,7 @@ int ocfs2_calc_xattr_init(struct inode *dir, umode_t mode,
> }
>
> if (!(s_size + a_size))
> - return ret;
> + return 0;
>
> /*
> * The max space of security xattr taken inline is
> @@ -729,7 +728,7 @@ int ocfs2_calc_xattr_init(struct inode *dir, umode_t mode,
> }
> }
>
> - return ret;
> + return 0;
> }
>
> static int ocfs2_xattr_extend_allocation(struct inode *inode,
>
> base-commit: bc35965f6940a9bf834d54187b6088b8eb09206d