From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: <darshanrathod475@gmail.com>
Cc: <dave@stgolabs.net>, <dave.jiang@intel.com>,
<alison.schofield@intel.com>, <vishal.l.verma@intel.com>,
<ira.weiny@intel.com>, <dan.j.williams@intel.com>,
<shiju.jose@huawei.com>, <ming.li@zohomail.com>,
<peterz@infradead.org>, <linux-cxl@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cxl: remove assignment from if condition in cxl_mem_get_poison
Date: Wed, 13 Aug 2025 13:52:07 +0100 [thread overview]
Message-ID: <20250813135207.00000727@huawei.com> (raw)
In-Reply-To: <20250813115554.388368-1-darshanrathod475@gmail.com>
On Wed, 13 Aug 2025 17:25:54 +0530
darshanrathod475@gmail.com wrote:
> From: Darshan Rathod <darshanrathod475@gmail.com>
>
> Refactor cxl_mem_get_poison() to assign the return value of
> ACQUIRE_ERR() before the conditional check, instead of performing the
> assignment inside the if condition. This resolves a checkpatch.pl
> warning ("do not use assignment in if condition") and improves
> readability.
>
> Signed-off-by: Darshan Rathod <darshanrathod475@gmail.com>
See:
https://lore.kernel.org/all/20250813003821.2891532-1-alison.schofield@intel.com/
Which stops checkpatch complaining about this.
Let's see where that discussion ends up before considering 'fixing' this.
Jonathan
> ---
> drivers/cxl/core/mbox.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index fa6dd0c94656..9c5066631896 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -1426,7 +1426,9 @@ int cxl_mem_get_poison(struct cxl_memdev *cxlmd, u64 offset, u64 len,
> int rc;
>
> ACQUIRE(mutex_intr, lock)(&mds->poison.mutex);
> - if ((rc = ACQUIRE_ERR(mutex_intr, &lock)))
> +
> + rc = ACQUIRE_ERR(mutex_intr, &lock);
> + if (rc)
> return rc;
>
> po = mds->poison.list_out;
next prev parent reply other threads:[~2025-08-13 12:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 11:55 darshanrathod475
2025-08-13 12:52 ` Jonathan Cameron [this message]
2025-08-13 13:07 ` Darshan Rathod
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=20250813135207.00000727@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=darshanrathod475@gmail.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=peterz@infradead.org \
--cc=shiju.jose@huawei.com \
--cc=vishal.l.verma@intel.com \
/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
all inboxes | Powered by JetHome®