diff mbox series

[U-Boot,RFC,05/29] drivers: pci-uclass: make DT subnode parse optional

Message ID 20191029210821.1954-6-suneelglinux@gmail.com
State RFC
Delegated to: Tom Rini
Headers show
Series arm: Introduce Marvell/Cavium OcteonTX | expand

Commit Message

Suneel Garapati Oct. 29, 2019, 9:07 p.m. UTC
From: Suneel Garapati <sgarapati@marvell.com>

Parse subnode DT properties only if parent node is valid.
Otherwise, assert is triggered on ofnode_valid in ofnode_first_subnode
from dev_for_each_subnode.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
---
 drivers/pci/pci-uclass.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Simon Glass Nov. 20, 2019, 3 a.m. UTC | #1
On Tue, 29 Oct 2019 at 14:08, Suneel Garapati <suneelglinux@gmail.com> wrote:
>
> From: Suneel Garapati <sgarapati@marvell.com>
>
> Parse subnode DT properties only if parent node is valid.
> Otherwise, assert is triggered on ofnode_valid in ofnode_first_subnode
> from dev_for_each_subnode.
>
> Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
> ---
>  drivers/pci/pci-uclass.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

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 848ac5a65e..007b7472c6 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -675,7 +675,8 @@  static int pci_find_and_bind_driver(struct udevice *parent,
 	      find_id->vendor, find_id->device);
 
 	/* Determine optional OF node */
-	pci_dev_find_ofnode(parent, bdf, &node);
+	if (ofnode_valid(dev_ofnode(parent)))
+		pci_dev_find_ofnode(parent, bdf, &node);
 
 	start = ll_entry_start(struct pci_driver_entry, pci_driver_entry);
 	n_ents = ll_entry_count(struct pci_driver_entry, pci_driver_entry);