From: Jeff Layton <jlayton@kernel.org>
To: hhtracer@gmail.com, trondmy@kernel.org, anna@kernel.org
Cc: linux-nfs@vger.kernel.org, huhai <huhai@kylinos.cn>
Subject: Re: [PATCH] nfs: Use IS_ERR_OR_NULL() helper function
Date: Fri, 18 Apr 2025 13:27:06 -0400 [thread overview]
Message-ID: <0a833c99203c7aea6e98754d504fd9992f774948.camel@kernel.org> (raw)
In-Reply-To: <20250413040828.2529-1-huhai@kylinos.cn>
On Sun, 2025-04-13 at 12:08 +0800, hhtracer@gmail.com wrote:
> From: huhai <huhai@kylinos.cn>
>
> Use the IS_ERR_OR_NULL() helper instead of open-coding a
> NULL and an error pointer checks to simplify the code and
> improve readability.
>
> No functional changes are intended.
>
> Signed-off-by: huhai <huhai@kylinos.cn>
> ---
> fs/nfs/write.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/fs/nfs/write.c b/fs/nfs/write.c
> index 23df8b214474..bf44ab0f5de3 100644
> --- a/fs/nfs/write.c
> +++ b/fs/nfs/write.c
> @@ -637,14 +637,13 @@ static int nfs_page_async_flush(struct folio *folio,
> struct nfs_pageio_descriptor *pgio)
> {
> struct nfs_page *req;
> - int ret = 0;
> + int ret;
>
> req = nfs_lock_and_join_requests(folio);
> - if (!req)
> - goto out;
> - ret = PTR_ERR(req);
> - if (IS_ERR(req))
> + if (IS_ERR_OR_NULL(req)) {
> + ret = PTR_ERR_OR_ZERO(req);
> goto out;
> + }
>
> nfs_folio_set_writeback(folio);
> WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags));
Looks right to me.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2025-04-18 17:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-13 4:08 [PATCH] nfs: Use IS_ERR_OR_NULL() helper function hhtracer
2025-04-18 17:27 ` Jeff Layton [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=0a833c99203c7aea6e98754d504fd9992f774948.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=anna@kernel.org \
--cc=hhtracer@gmail.com \
--cc=huhai@kylinos.cn \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.org \
/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