diff mbox series

[v1,11/24] pci: pci-uclass: Check validity of ofnode

Message ID 20200724100856.1482324-12-sr@denx.de
State Superseded
Delegated to: Stefan Roese
Headers show
Series arm: Introduce Marvell/Cavium OcteonTX/TX2 | expand

Commit Message

Stefan Roese July 24, 2020, 10:08 a.m. UTC
From: Suneel Garapati <sgarapati@marvell.com>

Add check if the referenced ofnode is valid.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>

Signed-off-by: Stefan Roese <sr@denx.de>
---

Changes in v1:
- New patch

 drivers/pci/pci-uclass.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Simon Glass July 28, 2020, 7:01 p.m. UTC | #1
On Fri, 24 Jul 2020 at 04:09, Stefan Roese <sr@denx.de> wrote:
>
> From: Suneel Garapati <sgarapati@marvell.com>
>
> Add check if the referenced ofnode is valid.
>
> Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Bin Meng <bmeng.cn@gmail.com>
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> ---
>
> Changes in v1:
> - New patch
>
>  drivers/pci/pci-uclass.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index be685f9143..77ac2e0f2b 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -539,7 +539,8 @@  int pci_auto_config_devices(struct udevice *bus)
 		int ret;
 
 		debug("%s: device %s\n", __func__, dev->name);
-		if (dev_read_bool(dev, "pci,no-autoconfig"))
+		if (dev_of_valid(dev) &&
+		    dev_read_bool(dev, "pci,no-autoconfig"))
 			continue;
 		ret = dm_pciauto_config_device(dev);
 		if (ret < 0)
@@ -1026,8 +1027,11 @@  static int pci_uclass_pre_probe(struct udevice *bus)
 	hose->bus = bus;
 	hose->first_busno = bus->seq;
 	hose->last_busno = bus->seq;
-	hose->skip_auto_config_until_reloc =
-		dev_read_bool(bus, "u-boot,skip-auto-config-until-reloc");
+	if (dev_of_valid(bus)) {
+		hose->skip_auto_config_until_reloc =
+			dev_read_bool(bus,
+				      "u-boot,skip-auto-config-until-reloc");
+	}
 
 	return 0;
 }