[PATCH] smb: client: Simplify a return statement in get_smb2_acl_by_path()
Steve French
smfrench at gmail.com
Wed Oct 8 22:53:34 UTC 2025
This is an example of one that is probably slightly worth it, it shrinks
one line of code, and also doesn't have risk, but at least three of the
others today don't shrink and sometimes grow lines of code (and don't fix
anything ) so are unlikely to be worth it since they slightly increase risk
of adding difficulty to stable backports of future fixes
Thanks,
Steve
On Wed, Oct 8, 2025, 3:02 PM Markus Elfring <Markus.Elfring at web.de> wrote:
> From: Markus Elfring <elfring at users.sourceforge.net>
> Date: Wed, 8 Oct 2025 21:56:34 +0200
>
> Return an error pointer without referencing another local variable
> in an if branch of this function implementation.
>
> Signed-off-by: Markus Elfring <elfring at users.sourceforge.net>
> ---
> fs/smb/client/smb2ops.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
> index 7c3e96260fd4..bb5eda032aa4 100644
> --- a/fs/smb/client/smb2ops.c
> +++ b/fs/smb/client/smb2ops.c
> @@ -3216,9 +3216,8 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
>
> utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
> if (!utf16_path) {
> - rc = -ENOMEM;
> free_xid(xid);
> - return ERR_PTR(rc);
> + return ERR_PTR(-ENOMEM);
> }
>
> oparms = (struct cifs_open_parms) {
> --
> 2.51.0
>
>
>
More information about the samba-technical
mailing list