public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Markus Elfring <Markus.Elfring@web.de>,
	<linux-mtd@lists.infradead.org>,
	Richard Weinberger <richard@nod.at>
Cc: LKML <linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH 2/2] ubifs: Reduce kfree() calls in ubifs_purge_xattrs()
Date: Thu, 26 Sep 2024 19:13:04 +0800	[thread overview]
Message-ID: <2012c8b6-b960-d597-481d-5f051686ffe1@huawei.com> (raw)
In-Reply-To: <fc35a4b0-9a41-4f14-9558-99fc0b7e2ad8@web.de>

在 2024/9/26 17:50, Markus Elfring 写道:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 26 Sep 2024 11:28:48 +0200
> 
> Move a pair of kfree() calls behind the label “out_err”
> so that two statements can be better reused at the end of
> this function implementation.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>   fs/ubifs/xattr.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
> index 7757959e9f09..a514dc4dc535 100644
> --- a/fs/ubifs/xattr.c
> +++ b/fs/ubifs/xattr.c
> @@ -532,8 +532,6 @@ int ubifs_purge_xattrs(struct inode *host)
>   			ubifs_err(c, "dead directory entry '%s', error %d",
>   				  xent->name, err);
>   			ubifs_ro_mode(c, err);
> -			kfree(pxent);
> -			kfree(xent);
>   			goto out_err;
>   		}
> 
> @@ -543,8 +541,6 @@ int ubifs_purge_xattrs(struct inode *host)
>   		err = remove_xattr(c, host, xino, &nm);
>   		iput(xino);
>   		if (err) {
> -			kfree(pxent);
> -			kfree(xent);
>   			ubifs_err(c, "cannot remove xattr, error %d", err);
>   			goto out_err;
>   		}
> @@ -564,6 +560,8 @@ int ubifs_purge_xattrs(struct inode *host)
>   	return 0;
> 
>   out_err:
> +	kfree(pxent);
> +	kfree(xent);
>   	up_write(&ubifs_inode(host)->xattr_sem);
>   	return err;
>   }
> --
> 2.46.1
> 
> .
> 


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2024-09-26 11:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26  9:48 [PATCH 0/2] ubifs: Adjustments for ubifs_purge_xattrs() Markus Elfring
2024-09-26  9:49 ` [PATCH 1/2] ubifs: Call iput(xino) only once in ubifs_purge_xattrs() Markus Elfring
2024-09-26 11:12   ` Zhihao Cheng
2024-09-26  9:50 ` [PATCH 2/2] ubifs: Reduce kfree() calls " Markus Elfring
2024-09-26 11:13   ` Zhihao Cheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2012c8b6-b960-d597-481d-5f051686ffe1@huawei.com \
    --to=chengzhihao1@huawei.com \
    --cc=Markus.Elfring@web.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox