Linux CXL
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Richard Cheng" <icheng@nvidia.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH 1/2] cxl: Convert PCIBIOS errors to errno on remaining DVSEC/PCIe accesses
Date: Sun, 07 Jun 2026 07:13:12 +0000	[thread overview]
Message-ID: <20260607071312.B83331F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260607070241.48978-2-icheng@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete conversion of PCIBIOS error codes leaves `update_gpf_port_dvsec()` with an inconsistent return type.
--

commit 84be8b4e0a3d7e5cbd94897e592a3a721caed448
Author: Richard Cheng <icheng@nvidia.com>

cxl: Convert PCIBIOS errors to errno on remaining DVSEC/PCIe accesses
    
PCI config and PCIe capability accessors return positive PCIBIOS_*
status codes on failure, not negative errnos. update_gpf_port_dvsec()
and cxl_setup_parent_dport() propagate these raw values to callers that
test for failure with "if (rc)" and expect a negative errno, which can
misreport the error.
    
Conver the positive PCIBIOS status with pcibios_err_to_errno() on these
error paths.

> diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
> index e4338fd7e01b4..ea81a170132fb 100644
> --- a/drivers/cxl/core/pci.c
> +++ b/drivers/cxl/core/pci.c
> @@ -852,7 +852,7 @@ static int update_gpf_port_dvsec(struct pci_dev *pdev, int dvsec, int phase)
>  		pci_dbg(pdev, "Port GPF phase %d timeout: %d0 secs\n",
>  			phase, GPF_TIMEOUT_BASE_MAX);
>  
> -	return rc;
> +	return pcibios_err_to_errno(rc);

[Severity: Medium]
Does this function still return an unconverted PCIBIOS error code on the early
read failure path?

Looking earlier in update_gpf_port_dvsec():

	rc = pci_read_config_word(pdev, dvsec + offset, &ctrl);
	if (rc)
		return rc;

If pci_read_config_word() fails, it returns a positive PCIBIOS error code.
This leaves the function with an inconsistent return type where it returns
positive error codes for read failures and negative errnos for write failures.

Should the read failure path also be converted with pcibios_err_to_errno()?

>  }
>  
>  int cxl_gpf_port_setup(struct cxl_dport *dport)

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260607070241.48978-1-icheng@nvidia.com?part=1

  reply	other threads:[~2026-06-07  7:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-07  7:02 [PATCH 0/2] cxl: Convert remaining PCIBIOS errors to errno Richard Cheng
2026-06-07  7:02 ` [PATCH 1/2] cxl: Convert PCIBIOS errors to errno on remaining DVSEC/PCIe accesses Richard Cheng
2026-06-07  7:13   ` sashiko-bot [this message]
2026-06-07  7:02 ` [PATCH 2/2] cxl/core/regs: Check return value of DVSEC register locator reads Richard Cheng
2026-06-07  7:13   ` sashiko-bot

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=20260607071312.B83331F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=icheng@nvidia.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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