Skip to content

Commit 5b17dba

Browse files
committed
Merge branch 'remotes/lorenzo/pci/aardvark'
- Indicate error in 'val' when config read fails (Pali Rohár) - Don't touch PCIe registers if no card connected (Pali Rohár) * remotes/lorenzo/pci/aardvark: PCI: aardvark: Don't touch PCIe registers if no card connected PCI: aardvark: Indicate error in 'val' when config read fails
2 parents 06f3506 + 70e3802 commit 5b17dba

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/pci/controller/pci-aardvark.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,13 @@ static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,
644644
if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0)
645645
return false;
646646

647+
/*
648+
* If the link goes down after we check for link-up, nothing bad
649+
* happens but the config access times out.
650+
*/
651+
if (bus->number != pcie->root_bus_nr && !advk_pcie_link_up(pcie))
652+
return false;
653+
647654
return true;
648655
}
649656

@@ -688,8 +695,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
688695
advk_writel(pcie, 1, PIO_START);
689696

690697
ret = advk_pcie_wait_pio(pcie);
691-
if (ret < 0)
698+
if (ret < 0) {
699+
*val = 0xffffffff;
692700
return PCIBIOS_SET_FAILED;
701+
}
693702

694703
advk_pcie_check_pio_status(pcie);
695704

0 commit comments

Comments
 (0)