PCI: aardvark: Indicate error in 'val' when config read fails
authorPali Rohár <pali@kernel.org>
Mon, 1 Jun 2020 13:03:15 +0000 (15:03 +0200)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tue, 7 Jul 2020 14:37:22 +0000 (15:37 +0100)
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.

Link: https://lore.kernel.org/r/20200528162604.GA323482@bjorn-Precision-5520
Link: https://lore.kernel.org/r/20200601130315.18895-1-pali@kernel.org
Reported-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
drivers/pci/controller/pci-aardvark.c

index 90ff291c24f091978164260cc96d363874ad42e2..7872035dbb03cf5b0d1a8afc130630e4fc54b9fa 100644 (file)
@@ -688,8 +688,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);