From: Alison Schofield <alison.schofield@intel.com>
To: Richard Cheng <icheng@nvidia.com>
Cc: <jic23@kernel.org>, <dave@stgolabs.net>, <dave.jiang@intel.com>,
<vishal.l.verma@intel.com>, <djbw@kernel.org>,
<danwilliams@nvidia.com>, <iweiny@kernel.org>,
<ming.li@zohomail.com>, <linux-cxl@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <newtonl@nvidia.com>,
<kristinc@nvidia.com>, <kaihengf@nvidia.com>, <kobak@nvidia.com>,
<vaslot@nvidia.com>, <mochs@nvidia.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v8 1/3] cxl/region: Simplify poison_by_decoder() error handling
Date: Fri, 31 Jul 2026 12:06:43 -0700 [thread overview]
Message-ID: <amzyQ1BTDiwfe1b1@aschofie-mobl2.lan> (raw)
In-Reply-To: <20260731064902.34127-2-icheng@nvidia.com>
On Fri, Jul 31, 2026 at 02:49:00PM +0800, Richard Cheng wrote:
> "rc" carries both an error code and the loop control
> signal for device_for_each_child(), so returning it bare is misleading,
> the early guards mean "keep walking", not "no error". Zeroing "rc" to
> forgive an -EFAULT on a RAM partition adds to that by discarding what
> the device actually returned.
>
> Return a literal 0 where the walk should continue, and test the
> forgiven case directly instead of rewriting "rc". No functional change.
I walked thru to confirm the no functional change.
The old rc=0 was never read again on either patch. Each return rc you
converted was reachable only with rc at its initializer.
One comment below wrt the EFAULT case -
>
> Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Richard Cheng <icheng@nvidia.com>
> ---
> drivers/cxl/core/region.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 1e211542b6b6..fabaad3469b1 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -2950,14 +2950,14 @@ static int poison_by_decoder(struct device *dev, void *arg)
> struct cxl_dev_state *cxlds;
> struct cxl_memdev *cxlmd;
> u64 offset, length;
> - int rc = 0;
> + int rc;
>
> if (!is_endpoint_decoder(dev))
> - return rc;
> + return 0;
>
> cxled = to_cxl_endpoint_decoder(dev);
> if (!cxled->dpa_res)
> - return rc;
> + return 0;
>
> cxlmd = cxled_to_memdev(cxled);
> cxlds = cxlmd->cxlds;
> @@ -2967,18 +2967,14 @@ static int poison_by_decoder(struct device *dev, void *arg)
> offset = cxled->dpa_res->start - cxled->skip;
> length = cxled->skip;
> rc = cxl_mem_get_poison(cxlmd, offset, length, NULL);
> - if (rc == -EFAULT && mode == CXL_PARTMODE_RAM)
> - rc = 0;
> - if (rc)
> + if (rc && (rc != -EFAULT || mode != CXL_PARTMODE_RAM))
> return rc;
I notice that the rule "forgive -EFAULT on a RAM partition" is now spelled
two different ways within twenty lines of each other.
cxl_get_poison_unmapped() uses the positive form, while here we invert
it. Can you flip that or add a poison_efault_forgiven() helper so both
usages read the same?
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
next prev parent reply other threads:[~2026-07-31 19:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 6:48 [PATCH v8 0/3] Support zero-sized HDM decoders Richard Cheng
2026-07-31 6:49 ` [PATCH v8 1/3] cxl/region: Simplify poison_by_decoder() error handling Richard Cheng
2026-07-31 19:06 ` Alison Schofield [this message]
2026-08-05 3:39 ` Richard Cheng
2026-07-31 6:49 ` [PATCH v8 2/3] cxl/hdm: Allow zero sized HDM decoders Richard Cheng
2026-07-31 6:49 ` [PATCH v8 3/3] tools/testing/cxl: Enable zero sized decoders under hb0 Richard Cheng
2026-07-31 18:52 ` [PATCH v8 0/3] Support zero-sized HDM decoders Alison Schofield
2026-08-05 3:16 ` Richard Cheng
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=amzyQ1BTDiwfe1b1@aschofie-mobl2.lan \
--to=alison.schofield@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=danwilliams@nvidia.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=djbw@kernel.org \
--cc=icheng@nvidia.com \
--cc=iweiny@kernel.org \
--cc=jic23@kernel.org \
--cc=kaihengf@nvidia.com \
--cc=kobak@nvidia.com \
--cc=kristinc@nvidia.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=mochs@nvidia.com \
--cc=newtonl@nvidia.com \
--cc=vaslot@nvidia.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®