diff mbox series

[1/2] PCI: of: Don't fail devm_pci_alloc_host_bridge() on missing 'ranges'

Message ID 20210803215656.3803204-1-robh@kernel.org (mailing list archive)
State Accepted
Delegated to: Bjorn Helgaas
Headers show
Series [1/2] PCI: of: Don't fail devm_pci_alloc_host_bridge() on missing 'ranges' | expand

Commit Message

Rob Herring (Arm) Aug. 3, 2021, 9:56 p.m. UTC
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.

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

Comments

Bjorn Helgaas Aug. 3, 2021, 11:43 p.m. UTC | #1
On Tue, Aug 03, 2021 at 03:56:55PM -0600, Rob Herring wrote:
> 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.

s/latter/later/

> Fixes: 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()")
> Reported-by: Rafał Miłecki <zajec5@gmail.com>
> Cc: Srinath Mannam <srinath.mannam@broadcom.com>
> Cc: Roman Bacik <roman.bacik@broadcom.com>
> Cc: Bharat Gooty <bharat.gooty@broadcom.com>
> Cc: Abhishek Shah <abhishek.shah@broadcom.com>
> Cc: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
> Cc: Ray Jui <ray.jui@broadcom.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Signed-off-by: Rob Herring <robh@kernel.org>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

I assume Lorenzo will merge this along with the iproc change.

> ---
>  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
>
Rafał Miłecki Aug. 4, 2021, 6:47 a.m. UTC | #2
On 03.08.2021 23:56, Rob Herring wrote:
> 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.
> 
> Fixes: 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()")
> Reported-by: Rafał Miłecki <zajec5@gmail.com>
> Cc: Srinath Mannam <srinath.mannam@broadcom.com>
> Cc: Roman Bacik <roman.bacik@broadcom.com>
> Cc: Bharat Gooty <bharat.gooty@broadcom.com>
> Cc: Abhishek Shah <abhishek.shah@broadcom.com>
> Cc: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
> Cc: Ray Jui <ray.jui@broadcom.com>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Signed-off-by: Rob Herring <robh@kernel.org>

You're great Rob, thank you!

I've tested it on top of the 669cbc708122 and linux-5.10.y.

Tested-by: Rafał Miłecki <rafal@milecki.pl>
Lorenzo Pieralisi Aug. 4, 2021, 11:23 a.m. UTC | #3
On Tue, 3 Aug 2021 15:56:55 -0600, Rob Herring wrote:
> 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.
> 
> [...]

Applied to pci/iproc, thanks!

[1/2] PCI: of: Don't fail devm_pci_alloc_host_bridge() on missing 'ranges'
      https://git.kernel.org/lpieralisi/pci/c/d277f6e88c
[2/2] PCI: iproc: Fix BCMA probe resource handling
      https://git.kernel.org/lpieralisi/pci/c/aeaea8969b

Thanks,
Lorenzo
diff mbox series

Patch

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) {