Skip to contentSkip to conversation

cxl/pci: Fix the incorrect check of pci_config_read/write*() returns

PATCH Superseded Dave Jiang 4 participants 14 messages Jun 3 – Jun 4 CXL

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dave Jiang

author maintainer
#0 lore raw

cover cxl/pci: Fix the incorrect check of pci_config_read/write*() returns

The patches are inspired by comments from Richard Cheng WRT pci config accessors return PCIBIOS errors that are positive integers rather than negative errnos. I went and audited the cxl PCI code and found a few locations that need to be fixed. There are other locations that may trigger issues, but at this point we'll fix them as they happen.

Dave Jiang (2):
cxl/pci: Fix the incorrect check of pci_read_config_word() return cxl/pci: Convert PCIBIOS errors to errno on DVSEC config accesses

 drivers/cxl/core/pci.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8

Signature · 1 line
2.54.0
author maintainer
#1 lore raw

PATCH 1/2 cxl/pci: Fix the incorrect check of pci_read_config_word() return

pci_read_config_word() returns PCIBIOS_* status on error which are positive values. The check should be for non-zero values to indicate error. Fix cxl_set_mem_enable() to check for non-zero return value instead of negative value.

While fixing this, also convert the error to negative errno value when returning on error path.

Fixes 34e37b4c432c ("cxl/port: Enable HDM Capability after validating DVSEC Ranges")
Assisted-by Claude:claude-opus-4-8
---
 drivers/cxl/core/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/cxl/core/pci.c +4 -4
index d1f487b3d809..43885c59a7f2 100644
@@ -187,8 +187,8 @@ static int cxl_set_mem_enable(struct cxl_dev_state *cxlds, u16 val)
 	int rc;
 
 	rc = pci_read_config_word(pdev, d + PCI_DVSEC_CXL_CTRL, &ctrl);
-	if (rc < 0)
-		return rc;
+	if (rc)
+		return pcibios_err_to_errno(rc);
 
 	if ((ctrl & PCI_DVSEC_CXL_MEM_ENABLE) == val)
 		return 1;
@@ -196,8 +196,8 @@ static int cxl_set_mem_enable(struct cxl_dev_state *cxlds, u16 val)
 	ctrl |= val;
 
 	rc = pci_write_config_word(pdev, d + PCI_DVSEC_CXL_CTRL, ctrl);
-	if (rc < 0)
-		return rc;
+	if (rc)
+		return pcibios_err_to_errno(rc);
 
 	return 0;
 }
Signature · 1 line
2.54.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] cxl/pci: Fix the incorrect check of pci_read_config_word() return

Quoted 45 lines · Dave Jiang

pci_read_config_word() returns PCIBIOS_* status on error which are positive values. The check should be for non-zero values to indicate error. Fix cxl_set_mem_enable() to check for non-zero return value instead of negative value.

While fixing this, also convert the error to negative errno value when returning on error path.

Fixes 34e37b4c432c ("cxl/port: Enable HDM Capability after validating DVSEC Ranges")
Assisted-by Claude:claude-opus-4-8
---
 drivers/cxl/core/pci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/cxl/core/pci.c +4 -4
index d1f487b3d809..43885c59a7f2 100644
@@ -187,8 +187,8 @@ static int cxl_set_mem_enable(struct cxl_dev_state *cxlds, u16 val)
 	int rc;
 
 	rc = pci_read_config_word(pdev, d + PCI_DVSEC_CXL_CTRL, &ctrl);
-	if (rc < 0)
-		return rc;
+	if (rc)
+		return pcibios_err_to_errno(rc);
 
 	if ((ctrl & PCI_DVSEC_CXL_MEM_ENABLE) == val)
 		return 1;
@@ -196,8 +196,8 @@ static int cxl_set_mem_enable(struct cxl_dev_state *cxlds, u16 val)
 	ctrl |= val;
 
 	rc = pci_write_config_word(pdev, d + PCI_DVSEC_CXL_CTRL, ctrl);
-	if (rc < 0)
-		return rc;
+	if (rc)
+		return pcibios_err_to_errno(rc);
 
 	return 0;
 }
Signature · 1 line
2.54.0
maintainer Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] cxl/pci: Fix the incorrect check of pci_read_config_word() return

In reply to Dave Jiang
Quoted 7 lines · Dave Jiang

pci_read_config_word() returns PCIBIOS_* status on error which are positive values. The check should be for non-zero values to indicate error. Fix cxl_set_mem_enable() to check for non-zero return value instead of negative value.

While fixing this, also convert the error to negative errno value when returning on error path.

author maintainer
#4 lore raw

PATCH 2/2 cxl/pci: Convert PCIBIOS errors to errno on DVSEC config accesses

In reply to Dave Jiang

PCI config space accessors return positive PCIBIOS_* status codes on failure that are positive integers. Several DVSEC accesses in the CXL core propagated these raw values to callers that test for failure against less than 0. Thus silently misinterpret the return value as success.

cxl_dvsec_rr_decode() and cxl_dvsec_mem_range_valid() are the two that have callers make such assumptions so far in the cxl/core. Convert the postive error values to negative errno values so the checks are correct on error paths.

While the chances of a config access failure are low, fix for correctness and to avoid confusion in the future when more DVSEC accesses are added.

Fixes 6612bd9ff0b1 ("PCI: Update CXL DVSEC definitions")
Fixes ce17ad0d5498 ("cxl: Wait Memory_Info_Valid before access memory related info")
Assisted-by Claude:claude-opus-4-8
---
 drivers/cxl/core/pci.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/cxl/core/pci.c +7 -7
index 43885c59a7f2..cb33dc8139dc 100644
@@ -89,7 +89,7 @@ static int cxl_dvsec_mem_range_valid(struct cxl_dev_state *cxlds, int id)
 					   d + PCI_DVSEC_CXL_RANGE_SIZE_LOW(id),
 					   &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		valid = FIELD_GET(PCI_DVSEC_CXL_MEM_INFO_VALID, temp);
 		if (valid)
@@ -275,7 +275,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 
 	rc = pci_read_config_word(pdev, d + PCI_DVSEC_CXL_CAP, &cap);
 	if (rc)
-		return rc;
+		return pcibios_err_to_errno(rc);
 
 	if (!(cap & PCI_DVSEC_CXL_MEM_CAPABLE)) {
 		dev_dbg(dev, "Not MEM Capable\n");
@@ -299,7 +299,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 	 */
 	rc = pci_read_config_word(pdev, d + PCI_DVSEC_CXL_CTRL, &ctrl);
 	if (rc)
-		return rc;
+		return pcibios_err_to_errno(rc);
 
 	info->mem_enabled = FIELD_GET(PCI_DVSEC_CXL_MEM_ENABLE, ctrl);
 	if (!info->mem_enabled)
@@ -316,14 +316,14 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_SIZE_HIGH(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		size = (u64)temp << 32;
 
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_SIZE_LOW(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		size |= temp & PCI_DVSEC_CXL_MEM_SIZE_LOW;
 		if (!size) {
@@ -333,14 +333,14 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_BASE_HIGH(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		base = (u64)temp << 32;
 
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_BASE_LOW(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		base |= temp & PCI_DVSEC_CXL_MEM_BASE_LOW;
 
Signature · 1 line
2.54.0
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] cxl/pci: Convert PCIBIOS errors to errno on DVSEC config accesses

Quoted 90 lines · Dave Jiang

PCI config space accessors return positive PCIBIOS_* status codes on failure that are positive integers. Several DVSEC accesses in the CXL core propagated these raw values to callers that test for failure against less than 0. Thus silently misinterpret the return value as success.

cxl_dvsec_rr_decode() and cxl_dvsec_mem_range_valid() are the two that have callers make such assumptions so far in the cxl/core. Convert the postive error values to negative errno values so the checks are correct on error paths.

While the chances of a config access failure are low, fix for correctness and to avoid confusion in the future when more DVSEC accesses are added.

Fixes 6612bd9ff0b1 ("PCI: Update CXL DVSEC definitions")
Fixes ce17ad0d5498 ("cxl: Wait Memory_Info_Valid before access memory related info")
Assisted-by Claude:claude-opus-4-8
---
 drivers/cxl/core/pci.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/cxl/core/pci.c +7 -7
index 43885c59a7f2..cb33dc8139dc 100644
@@ -89,7 +89,7 @@ static int cxl_dvsec_mem_range_valid(struct cxl_dev_state *cxlds, int id)
 					   d + PCI_DVSEC_CXL_RANGE_SIZE_LOW(id),
 					   &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		valid = FIELD_GET(PCI_DVSEC_CXL_MEM_INFO_VALID, temp);
 		if (valid)
@@ -275,7 +275,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 
 	rc = pci_read_config_word(pdev, d + PCI_DVSEC_CXL_CAP, &cap);
 	if (rc)
-		return rc;
+		return pcibios_err_to_errno(rc);
 
 	if (!(cap & PCI_DVSEC_CXL_MEM_CAPABLE)) {
 		dev_dbg(dev, "Not MEM Capable\n");
@@ -299,7 +299,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 	 */
 	rc = pci_read_config_word(pdev, d + PCI_DVSEC_CXL_CTRL, &ctrl);
 	if (rc)
-		return rc;
+		return pcibios_err_to_errno(rc);
 
 	info->mem_enabled = FIELD_GET(PCI_DVSEC_CXL_MEM_ENABLE, ctrl);
 	if (!info->mem_enabled)
@@ -316,14 +316,14 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_SIZE_HIGH(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		size = (u64)temp << 32;
 
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_SIZE_LOW(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		size |= temp & PCI_DVSEC_CXL_MEM_SIZE_LOW;
 		if (!size) {
@@ -333,14 +333,14 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_BASE_HIGH(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		base = (u64)temp << 32;
 
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_BASE_LOW(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		base |= temp & PCI_DVSEC_CXL_MEM_BASE_LOW;
 
Signature · 1 line
2.54.0
maintainer
#6 lore raw

Re: [PATCH 2/2] cxl/pci: Convert PCIBIOS errors to errno on DVSEC config accesses

In reply to Dave Jiang
Quoted 10 lines · Dave Jiang

PCI config space accessors return positive PCIBIOS_* status codes on failure that are positive integers. Several DVSEC accesses in the CXL core propagated these raw values to callers that test for failure against less than 0. Thus silently misinterpret the return value as success.

cxl_dvsec_rr_decode() and cxl_dvsec_mem_range_valid() are the two that have callers make such assumptions so far in the cxl/core. Convert the postive error values to negative errno values so the checks are correct on error paths.

Quoted 4 lines

While the chances of a config access failure are low, fix for correctness and to avoid confusion in the future when more DVSEC accesses are added.

Fixes 6612bd9ff0b1 ("PCI: Update CXL DVSEC definitions")

This first fixes tag is a macro rename. Look at this one:
1acba6e9206c ("cxl/pci: Break out range register decoding from cxl_hdm_decode_init()")

Quoted 12 lines
Fixes ce17ad0d5498 ("cxl: Wait Memory_Info_Valid before access memory related info")
Assisted-by Claude:claude-opus-4-8
---
 drivers/cxl/core/pci.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/cxl/core/pci.c +0 -0
index 43885c59a7f2..cb33dc8139dc 100644

drivers/cxl/core/pci.c static int cxl_dvsec_mem_range_valid(struct cxl_dev_state *cxlds, int id) · line 95

Quoted 8 lines
drivers/cxl/core/pci.c +1 -1
@@ -89,7 +89,7 @@ static int cxl_dvsec_mem_range_valid(struct cxl_dev_state *cxlds, int id)
 					   d + PCI_DVSEC_CXL_RANGE_SIZE_LOW(id),
 					   &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		valid = FIELD_GET(PCI_DVSEC_CXL_MEM_INFO_VALID, temp);
 		if (valid)

Above converts one twin and not the other, cxl_dvsec_mem_range_active()

With that cxl_await_media_ready() calls both, _valid & _active, and returns different error codes depending on which one fails.

Actually, cxl_await_media_ready() has 3 return sites:
- the cap read (pci_read_config_word) returns raw PCIBIOS
- cxl_dvsec_mem_range_active() returns raw PCIBIOS
- cxl_dvsec_mem_range_valid() returns negative errno (w this patch)

My suggestion is that cxl_await_media_ready() be made consistent, those 3 sites return negative errno, in one fixup patch.

Quoted 55 lines
drivers/cxl/core/pci.c +6 -6
@@ -275,7 +275,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 
 	rc = pci_read_config_word(pdev, d + PCI_DVSEC_CXL_CAP, &cap);
 	if (rc)
-		return rc;
+		return pcibios_err_to_errno(rc);
 
 	if (!(cap & PCI_DVSEC_CXL_MEM_CAPABLE)) {
 		dev_dbg(dev, "Not MEM Capable\n");
@@ -299,7 +299,7 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 	 */
 	rc = pci_read_config_word(pdev, d + PCI_DVSEC_CXL_CTRL, &ctrl);
 	if (rc)
-		return rc;
+		return pcibios_err_to_errno(rc);
 
 	info->mem_enabled = FIELD_GET(PCI_DVSEC_CXL_MEM_ENABLE, ctrl);
 	if (!info->mem_enabled)
@@ -316,14 +316,14 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_SIZE_HIGH(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		size = (u64)temp << 32;
 
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_SIZE_LOW(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		size |= temp & PCI_DVSEC_CXL_MEM_SIZE_LOW;
 		if (!size) {
@@ -333,14 +333,14 @@ int cxl_dvsec_rr_decode(struct cxl_dev_state *cxlds,
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_BASE_HIGH(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		base = (u64)temp << 32;
 
 		rc = pci_read_config_dword(
 			pdev, d + PCI_DVSEC_CXL_RANGE_BASE_LOW(i), &temp);
 		if (rc)
-			return rc;
+			return pcibios_err_to_errno(rc);
 
 		base |= temp & PCI_DVSEC_CXL_MEM_BASE_LOW;
 
Signature · 1 line
2.54.0
maintainer Reviewed-by on the v1 series
#7 lore raw
In reply to Dave Jiang
Quoted 6 lines · On Wed, 3 Jun 2026 11:57:50 -0700 Dave Jiang <[email protected]> wrote:

The patches are inspired by comments from Richard Cheng WRT pci config accessors return PCIBIOS errors that are positive integers rather than negative errnos. I went and audited the cxl PCI code and found a few locations that need to be fixed. There are other locations that may trigger issues, but at this point we'll fix them as they happen.

Quoted 10 lines

Dave Jiang (2):
cxl/pci: Fix the incorrect check of pci_read_config_word() return cxl/pci: Convert PCIBIOS errors to errno on DVSEC config accesses

 drivers/cxl/core/pci.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8

#8 lore raw
Quoted 8 lines · Jonathan Cameron
Quoted 5 lines · On Wed, 3 Jun 2026 11:57:50 -0700 Dave Jiang <[email protected]> wrote:

The patches are inspired by comments from Richard Cheng WRT pci config accessors return PCIBIOS errors that are positive integers rather than negative errnos. I went and audited the cxl PCI code and found a few locations that need to be fixed. There are other locations that may trigger issues, but at this point we'll fix them as they happen.

Hi Dave,

Thanks for this, sorry I miss the email somehow I'll look into details later, seems reasonable to me from a glimpse.

Best regards,
Richard Cheng.

Quoted 15 lines
Quoted 1 line
Quoted 10 lines

Dave Jiang (2):
cxl/pci: Fix the incorrect check of pci_read_config_word() return cxl/pci: Convert PCIBIOS errors to errno on DVSEC config accesses

 drivers/cxl/core/pci.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8

Reviewed-by
#9 lore raw
Quoted 10 lines · Richard Cheng
Quoted 8 lines · Jonathan Cameron
Quoted 5 lines · On Wed, 3 Jun 2026 11:57:50 -0700 Dave Jiang <[email protected]> wrote:

The patches are inspired by comments from Richard Cheng WRT pci config accessors return PCIBIOS errors that are positive integers rather than negative errnos. I went and audited the cxl PCI code and found a few locations that need to be fixed. There are other locations that may trigger issues, but at this point we'll fix them as they happen.

Quoted 12 lines

Hi Dave,

Thanks for this, sorry I miss the email somehow I'll look into details later, seems reasonable to me from a glimpse.

Best regards,
Richard Cheng.

Quoted 3 lines
Quoted 1 line

The series looks good to me. There is still some minor cleanup left — for example, cxl_dvsec_mem_range_active() still has the same problem. I plan to send follow-up patches for the remaining sites unless you prefer to fold them into this series.
Let me know what you think.

Quoted 13 lines
Quoted 12 lines
Quoted 10 lines

Dave Jiang (2):
cxl/pci: Fix the incorrect check of pci_read_config_word() return cxl/pci: Convert PCIBIOS errors to errno on DVSEC config accesses

 drivers/cxl/core/pci.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8

author maintainer
#10 lore raw
Quoted 25 lines · Richard Cheng
Quoted 10 lines · Richard Cheng
Quoted 8 lines · Jonathan Cameron
Quoted 5 lines · On Wed, 3 Jun 2026 11:57:50 -0700 Dave Jiang <[email protected]> wrote:

The patches are inspired by comments from Richard Cheng WRT pci config accessors return PCIBIOS errors that are positive integers rather than negative errnos. I went and audited the cxl PCI code and found a few locations that need to be fixed. There are other locations that may trigger issues, but at this point we'll fix them as they happen.

Quoted 12 lines

Hi Dave,

Thanks for this, sorry I miss the email somehow I'll look into details later, seems reasonable to me from a glimpse.

Best regards,
Richard Cheng.

Quoted 3 lines
Quoted 1 line
Quoted 5 lines

The series looks good to me. There is still some minor cleanup left — for example, cxl_dvsec_mem_range_active() still has the same problem. I plan to send follow-up patches for the remaining sites unless you prefer to fold them into this series.
Let me know what you think.

Go ahead and send your follow on patches since you know which sites you want to fix. I'll create a branch that you can apply on top of with these two.

DJ

Quoted 16 lines
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines

Dave Jiang (2):
cxl/pci: Fix the incorrect check of pci_read_config_word() return cxl/pci: Convert PCIBIOS errors to errno on DVSEC config accesses

 drivers/cxl/core/pci.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8

author maintainer
#11 lore raw
Quoted 28 lines · Dave Jiang
Quoted 25 lines · Richard Cheng
Quoted 22 lines · Richard Cheng
Quoted 8 lines · Jonathan Cameron
Quoted 5 lines · On Wed, 3 Jun 2026 11:57:50 -0700 Dave Jiang <[email protected]> wrote:

The patches are inspired by comments from Richard Cheng WRT pci config accessors return PCIBIOS errors that are positive integers rather than negative errnos. I went and audited the cxl PCI code and found a few locations that need to be fixed. There are other locations that may trigger issues, but at this point we'll fix them as they happen.

Hi Dave,

Thanks for this, sorry I miss the email somehow I'll look into details later, seems reasonable to me from a glimpse.

Best regards,
Richard Cheng.

Quoted 3 lines
Quoted 1 line
Quoted 7 lines
Quoted 5 lines

The series looks good to me. There is still some minor cleanup left — for example, cxl_dvsec_mem_range_active() still has the same problem. I plan to send follow-up patches for the remaining sites unless you prefer to fold them into this series.
Let me know what you think.

Go ahead and send your follow on patches since you know which sites you want to fix. I'll create a branch that you can apply on top of with these two.

Here's the branch:
https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git/log/?h=for-7.2/cxl-pci-fixes

author maintainer
#12 lore raw
In reply to Richard Cheng
Quoted 10 lines · Richard Cheng
Quoted 8 lines · Jonathan Cameron
Quoted 5 lines · On Wed, 3 Jun 2026 11:57:50 -0700 Dave Jiang <[email protected]> wrote:

The patches are inspired by comments from Richard Cheng WRT pci config accessors return PCIBIOS errors that are positive integers rather than negative errnos. I went and audited the cxl PCI code and found a few locations that need to be fixed. There are other locations that may trigger issues, but at this point we'll fix them as they happen.

Quoted 5 lines

Hi Dave,

Thanks for this, sorry I miss the email somehow I'll look into details later, seems reasonable to me from a glimpse.

Thanks for the review. Totally my fault. I think my brain said cc Richard when I was sending, but somehow I missed it.

DJ

Quoted 19 lines

Best regards,
Richard Cheng.

Quoted 15 lines
Quoted 1 line
Quoted 10 lines

Dave Jiang (2):
cxl/pci: Fix the incorrect check of pci_read_config_word() return cxl/pci: Convert PCIBIOS errors to errno on DVSEC config accesses

 drivers/cxl/core/pci.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8

maintainer
#13 lore raw
In reply to Dave Jiang
Quoted 5 lines · Dave Jiang

The patches are inspired by comments from Richard Cheng WRT pci config accessors return PCIBIOS errors that are positive integers rather than negative errnos. I went and audited the cxl PCI code and found a few locations that need to be fixed. There are other locations that may trigger issues, but at this point we'll fix them as they happen.

Feels like 'fix them as they happen' if OK for unrelated call sites, but in Patch 2 partial fixups look incomplete. See Patch 2 reply.