Skip to contentSkip to conversation

PCI: aardvark: Indicate error in 'val' when config read fails

PATCH Applied Pali Rohár 2 participants 5 messages Jun 1, 2020 – Jul 7, 2020

Subsystems (3)
lore
Share & tools
lore

Pali Rohár

author maintainer
#0 lore raw

PATCH 1/1 PCI: aardvark: Indicate error in 'val' when config read fails

Most callers of config read do not check for return value. But most of the ones that do, checks for error indication in 'val' variable.

This patch updates error handling in advk_pcie_rd_conf() function. If PIO transfer fails then 'val' variable is set to 0xffffffff which indicates failture.

---
 drivers/pci/controller/pci-aardvark.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +3 -1
index 53a4cfd7d377..783a7f1f2c44 100644
@@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
 	advk_writel(pcie, 1, PIO_START);
 
 	ret = advk_pcie_wait_pio(pcie);
-	if (ret < 0)
+	if (ret < 0) {
+		*val = 0xffffffff;
 		return PCIBIOS_SET_FAILED;
+	}
 
 	advk_pcie_check_pio_status(pcie);
 
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

Hello Lorenzo! Could you please review this patch?

Quoted 8 lines · On Monday 01 June 2020 15:03:15 Pali Rohár wrote:

Most callers of config read do not check for return value. But most of the ones that do, checks for error indication in 'val' variable.

This patch updates error handling in advk_pcie_rd_conf() function. If PIO transfer fails then 'val' variable is set to 0xffffffff which indicates failture.

I should add credit for Bjorn as he found this issue

Quoted 23 lines
---
 drivers/pci/controller/pci-aardvark.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +3 -1
index 53a4cfd7d377..783a7f1f2c44 100644
@@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
 	advk_writel(pcie, 1, PIO_START);
 
 	ret = advk_pcie_wait_pio(pcie);
-	if (ret < 0)
+	if (ret < 0) {
+		*val = 0xffffffff;
 		return PCIBIOS_SET_FAILED;
+	}
 
 	advk_pcie_check_pio_status(pcie);
 
Signature · 1 line
2.20.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw
Quoted 6 lines · Pali Rohár

Hello Lorenzo! Could you please review this patch?

Quoted 3 lines · On Monday 01 June 2020 15:03:15 Pali Rohár wrote:

Most callers of config read do not check for return value. But most of the ones that do, checks for error indication in 'val' variable.

Quoted 7 lines
Quoted 5 lines

This patch updates error handling in advk_pcie_rd_conf() function. If PIO transfer fails then 'val' variable is set to 0xffffffff which indicates failture.

I should add credit for Bjorn as he found this issue

Could you provide a lore archive link to the relevant discussion please ? I will apply it then.

Lorenzo

Quoted 25 lines
Quoted 23 lines
---
 drivers/pci/controller/pci-aardvark.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +3 -1
index 53a4cfd7d377..783a7f1f2c44 100644
@@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
 	advk_writel(pcie, 1, PIO_START);
 
 	ret = advk_pcie_wait_pio(pcie);
-	if (ret < 0)
+	if (ret < 0) {
+		*val = 0xffffffff;
 		return PCIBIOS_SET_FAILED;
+	}
 
 	advk_pcie_check_pio_status(pcie);
 
Signature · 1 line
2.20.1
author maintainer
#3 lore raw
Quoted 11 lines · On Tuesday 07 July 2020 14:53:11 Lorenzo Pieralisi wrote:
Quoted 10 lines · Pali Rohár

Hello Lorenzo! Could you please review this patch?

Quoted 7 lines · On Monday 01 June 2020 15:03:15 Pali Rohár wrote:

Most callers of config read do not check for return value. But most of the ones that do, checks for error indication in 'val' variable.

This patch updates error handling in advk_pcie_rd_conf() function. If PIO transfer fails then 'val' variable is set to 0xffffffff which indicates failture.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I should add credit for Bjorn as he found this issue

Could you provide a lore archive link to the relevant discussion please ? I will apply it then.

Hello Lorenzo! Here is link to the Bjorn's email:
https://lore.kernel.org/linux-pci/20200528162604.GA323482@bjorn-Precision-5520/

Quoted 27 lines

Lorenzo

Quoted 25 lines
Quoted 23 lines
---
 drivers/pci/controller/pci-aardvark.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +3 -1
index 53a4cfd7d377..783a7f1f2c44 100644
@@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
 	advk_writel(pcie, 1, PIO_START);
 
 	ret = advk_pcie_wait_pio(pcie);
-	if (ret < 0)
+	if (ret < 0) {
+		*val = 0xffffffff;
 		return PCIBIOS_SET_FAILED;
+	}
 
 	advk_pcie_check_pio_status(pcie);
 
Signature · 1 line
2.20.1
#4 lore raw
Quoted 14 lines · Pali Rohár
Quoted 13 lines · On Tuesday 07 July 2020 14:53:11 Lorenzo Pieralisi wrote:
Quoted 12 lines · Pali Rohár

Hello Lorenzo! Could you please review this patch?

Quoted 8 lines · On Monday 01 June 2020 15:03:15 Pali Rohár wrote:

Most callers of config read do not check for return value. But most of the ones that do, checks for error indication in 'val' variable.

This patch updates error handling in advk_pcie_rd_conf() function. If PIO transfer fails then 'val' variable is set to 0xffffffff which indicates failture.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I should add credit for Bjorn as he found this issue

Could you provide a lore archive link to the relevant discussion please ? I will apply it then.

Hello Lorenzo! Here is link to the Bjorn's email:
https://lore.kernel.org/linux-pci/20200528162604.GA323482@bjorn-Precision-5520/

Thanks applied to pci/aardvark.

Lorenzo

Quoted 27 lines
Quoted 27 lines

Lorenzo

Quoted 25 lines
Quoted 23 lines
---
 drivers/pci/controller/pci-aardvark.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +3 -1
index 53a4cfd7d377..783a7f1f2c44 100644
@@ -691,8 +691,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
 	advk_writel(pcie, 1, PIO_START);
 
 	ret = advk_pcie_wait_pio(pcie);
-	if (ret < 0)
+	if (ret < 0) {
+		*val = 0xffffffff;
 		return PCIBIOS_SET_FAILED;
+	}
 
 	advk_pcie_check_pio_status(pcie);
 
Signature · 1 line
2.20.1