From: Stefan Roese Date: Mon, 17 Aug 2020 09:07:50 +0200 Subject: [PATCH v2 13/25] pci: pci-uclass: Check validity of ofnode In-Reply-To: <20200817070802.1517632-1-sr@denx.de> References: <20200817070802.1517632-1-sr@denx.de> Message-ID: <20200817070802.1517632-14-sr@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Suneel Garapati Add check if the referenced ofnode is valid. Signed-off-by: Suneel Garapati Reviewed-by: Simon Glass Cc: Bin Meng Signed-off-by: Stefan Roese --- Changes in v2: - Add Reviewed-by tag from Simon Changes in v1: - New patch drivers/pci/pci-uclass.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index fc60dfe395..d8a6647a1d 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) @@ -1025,8 +1026,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; } -- 2.28.0