[PATCH for master 2/2] pci_of_match_device: don't crash on MIPS Malta

Antony Pavlov antonynpavlov at gmail.com
Wed Sep 12 14:00:06 PDT 2018


In arch/mips/mach-malta/pci.c PCI controller is instantiated
without dt and struct pci_controller parent field is NULL.

Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d206c53848..7abc7a3439 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -339,7 +339,7 @@ pci_of_match_device(struct device_d *parent, unsigned int devfn)
 	struct device_node *np;
 	u32 reg;
 
-	if (!IS_ENABLED(CONFIG_OFTREE) || !parent->device_node)
+	if (!IS_ENABLED(CONFIG_OFTREE) || !parent || !parent->device_node)
 		return NULL;
 
 	for_each_child_of_node(parent->device_node, np) {
-- 
2.18.0




More information about the barebox mailing list