[RESEND PATCH 2/4] pci-uclass: respect ofnode_read_pci_vendev retval

Matthias Brugger mbrugger at suse.com
Thu Nov 6 16:51:41 CET 2025



On 05/11/2025 17:44, Torsten Duwe wrote:
> The vendor:device read in pci_uclass_child_post_bind() might fail,
> which is currently ignored. In that case e.g. the RP1 on the RasPi5
> is erroneously being treated as a host bridge.
> 
> Mark the device's PCI info as invalid in case of failure.
> 
> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk at epam.com>
> Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk at epam.com>
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev at epam.com>
> Signed-off-by: Torsten Duwe <duwe at suse.de>
> Reviewed-by: Oleksii Moisieiev <oleksii_moisieiev at epam.com>

Reviewed-by: Matthias Brugger <mbrugger at suse.com>

> ---
>   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 c370f8c6400..4092e8ff5a9 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -1200,6 +1200,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;
> @@ -1207,7 +1208,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) {
> +		/* Mark PCI device structure as invalid */
> +		pplat->devfn = -1;
> +		return 0;
> +	}
>   
>   	/* Extract the devfn from fdt_pci_addr */
>   	pplat->devfn = pci_get_devfn(dev);



More information about the U-Boot mailing list