From: Volodymyr Babchuk <[email protected]> Prior to this fix devfn was set to 0, which lead to funny consequences because PCI subsystem tried to use RP1 driver as a host bridge driver.
Signed-off-by: Volodymyr Babchuk <[email protected]> Reviewed-by: Volodymyr Babchuk <[email protected]> Signed-off-by: Oleksii Moisieiev <[email protected]> --- drivers/pci/pci-uclass.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 1a48256de0..18b94583b6 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -1187,6 +1187,7 @@ static int pci_uclass_post_probe(struct udevice *bus) static int pci_uclass_child_post_bind(struct udevice *dev) { struct pci_child_plat *pplat; + int err; if (!dev_has_ofnode(dev)) return 0; @@ -1194,7 +1195,13 @@ static int pci_uclass_child_post_bind(struct udevice *dev) pplat = dev_get_parent_plat(dev); /* Extract vendor id and device id if available */ - ofnode_read_pci_vendev(dev_ofnode(dev), &pplat->vendor, &pplat->device); + err = ofnode_read_pci_vendev(dev_ofnode(dev), &pplat->vendor, + &pplat->device); + if (err) { + /* Set invalid devfn if OF node describes not a PCI device */ + pplat->devfn = -1; + return 0; + } /* Extract the devfn from fdt_pci_addr */ pplat->devfn = pci_get_devfn(dev); -- 2.34.1

