[PATCH 5.14 124/168] PCI: of: Dont fail devm_pci_alloc_host_bridge() on missing ranges

From: Greg Kroah-Hartman
Date: Mon Sep 20 2021 - 14:49:23 EST


From: Rob Herring <robh@xxxxxxxxxx>

[ Upstream commit d277f6e88c88729b1d57d40bbfb00d0bfc961972 ]

Commit 669cbc708122 ("PCI: Move DT resource setup into
devm_pci_alloc_host_bridge()") made devm_pci_alloc_host_bridge() fail on
any DT resource parsing errors, but Broadcom iProc uses
devm_pci_alloc_host_bridge() on BCMA bus devices that don't have DT
resources. In particular, there is no 'ranges' property. Fix iProc by
making 'ranges' optional.

If 'ranges' is required by a platform, there's going to be more errors
latter on if it is missing.

Link: https://lore.kernel.org/r/20210803215656.3803204-1-robh@xxxxxxxxxx
Fixes: 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()")
Reported-by: Rafał Miłecki <zajec5@xxxxxxxxx>
Tested-by: Rafał Miłecki <rafal@xxxxxxxxxx>
Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>
Acked-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Cc: Srinath Mannam <srinath.mannam@xxxxxxxxxxxx>
Cc: Roman Bacik <roman.bacik@xxxxxxxxxxxx>
Cc: Bharat Gooty <bharat.gooty@xxxxxxxxxxxx>
Cc: Abhishek Shah <abhishek.shah@xxxxxxxxxxxx>
Cc: Jitendra Bhivare <jitendra.bhivare@xxxxxxxxxxxx>
Cc: Ray Jui <ray.jui@xxxxxxxxxxxx>
Cc: Florian Fainelli <f.fainelli@xxxxxxxxx>
Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@xxxxxxxxxxxx>
Cc: Scott Branden <sbranden@xxxxxxxxxxxx>
Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/pci/of.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index a143b02b2dcd..d84381ce82b5 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -310,7 +310,7 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev,
/* Check for ranges property */
err = of_pci_range_parser_init(&parser, dev_node);
if (err)
- goto failed;
+ return 0;

dev_dbg(dev, "Parsing ranges property...\n");
for_each_of_pci_range(&parser, &range) {
--
2.30.2