U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Torsten Duwe <duwe@lst.de>
To: Peter Robinson <pbrobinson@gmail.com>
Cc: Matthias Brugger <mbrugger@suse.com>,
	Simon Glass <sjg@chromium.org>,
	Andrew Goodbody <andrew.goodbody@linaro.org>,
	Christian Marangi <ansuelsmth@gmail.com>,
	Elaine Zhang <zhangqing@rock-chips.com>,
	Gabriel Fernandez <gabriel.fernandez@foss.st.com>,
	Heiko Stuebner <heiko@sntech.de>, Huan Zhou <me@per1cycle.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	"Jan XXermXXk" <sairon@sairon.cz>,
	Jerome Forissier <jerome.forissier@linaro.org>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Joseph Chen <chenjh@rock-chips.com>,
	Kever Yang <kever.yang@rock-chips.com>,
	Leo Yu-Chi Liang <ycliang@andestech.com>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Paul Barker <paul.barker.ct@bp.renesas.com>,
	Ramon Fried <rfried.dev@gmail.com>, Tom Rini <trini@konsulko.com>,
	Volodymyr Babchuk <volodymyr_babchuk@epam.com>,
	Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>,
	Quentin Schulz <quentin.schulz@cherry.de>,
	u-boot@lists.denx.de
Subject: Re: [RESEND PATCH 2/4] pci-uclass: respect ofnode_read_pci_vendev retval
Date: Wed, 19 Nov 2025 17:47:40 +0100	[thread overview]
Message-ID: <20251119174740.00be0a78@rocky.lan> (raw)
In-Reply-To: <20251105164432.C8AA4227AAD@verein.lst.de>

Hi Peter,

please don't apply this one yet.

On Wed,  5 Nov 2025 17:44:32 +0100 (CET)
Torsten Duwe <duwe@lst.de> 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@epam.com>
> Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> Signed-off-by: Torsten Duwe <duwe@suse.de>
> Reviewed-by: Oleksii Moisieiev <oleksii_moisieiev@epam.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;

While I guess we all agree that an error return should not be ignored,
there might still be a better solution in this case. pplat->devfn = -1
might prevent the worst, but I assume the PCI dev 

| 02.1f.07   0xffff     0xffff     Does not fit any class  0xff

is a result of that.
 
> +		return 0;
> +	}
>  
>  	/* Extract the devfn from fdt_pci_addr */
>  	pplat->devfn = pci_get_devfn(dev);

thanks,
	Torsten

  parent reply	other threads:[~2025-11-19 16:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 16:35 [RESEND PATCH 0/4] Improve RaspBerry Pi 5 support part1: Fixes Torsten Duwe
2025-11-05 16:44 ` [RESEND PATCH 1/4] macb: wrap asm/arch/clk.h with ifndef CLK Torsten Duwe
2025-11-06 15:51   ` Matthias Brugger
2025-11-05 16:44 ` [RESEND PATCH 2/4] pci-uclass: respect ofnode_read_pci_vendev retval Torsten Duwe
2025-11-06 15:51   ` Matthias Brugger
2025-11-19 16:47   ` Torsten Duwe [this message]
2025-11-05 16:44 ` [RESEND PATCH 3/4] Fix #cells lookup in of_get_dma_range Torsten Duwe
2025-11-28 14:44   ` Peter Robinson
2025-11-05 16:44 ` [RESEND PATCH 4/4] pcie_brcmstb: use bus_base for PCI config devices Torsten Duwe
2025-11-28 14:38 ` [RESEND PATCH 0/4] Improve RaspBerry Pi 5 support part1: Fixes Peter Robinson
2026-07-19 10:43   ` Mike Groves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251119174740.00be0a78@rocky.lan \
    --to=duwe@lst.de \
    --cc=Oleksii_Moisieiev@epam.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=ansuelsmth@gmail.com \
    --cc=chenjh@rock-chips.com \
    --cc=gabriel.fernandez@foss.st.com \
    --cc=heiko@sntech.de \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jerome.forissier@linaro.org \
    --cc=joe.hershberger@ni.com \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=mbrugger@suse.com \
    --cc=me@per1cycle.org \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=paul.barker.ct@bp.renesas.com \
    --cc=pbrobinson@gmail.com \
    --cc=quentin.schulz@cherry.de \
    --cc=rfried.dev@gmail.com \
    --cc=sairon@sairon.cz \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=volodymyr_babchuk@epam.com \
    --cc=ycliang@andestech.com \
    --cc=zhangqing@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox