linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: rockchip: fix wrong check of pci_scan_root_bus_bridge
@ 2017-07-11 10:15 Shawn Lin
  2017-07-11 10:38 ` Lorenzo Pieralisi
  2017-07-12 17:55 ` Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Shawn Lin @ 2017-07-11 10:15 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: linux-pci, linux-rockchip, Brian Norris, Jeffy Chen, Shawn Lin,
	Lorenzo Pieralisi

It's wrong to check the return value of pci_scan_root_bus_bridge
here by using (!err) as 0 means it successfully scans the root
bridge. So the probe process will be terminated mistakenly.

Fixes: ae13cb9b ("PCI: rockchip: Convert PCI scan API to ...")
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/pci/host/pcie-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
index 5acf869..7bb9870 100644
--- a/drivers/pci/host/pcie-rockchip.c
+++ b/drivers/pci/host/pcie-rockchip.c
@@ -1483,7 +1483,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
 	bridge->swizzle_irq = pci_common_swizzle;
 
 	err = pci_scan_root_bus_bridge(bridge);
-	if (!err)
+	if (err < 0)
 		goto err_free_res;
 
 	bus = bridge->bus;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: rockchip: fix wrong check of pci_scan_root_bus_bridge
  2017-07-11 10:15 [PATCH] PCI: rockchip: fix wrong check of pci_scan_root_bus_bridge Shawn Lin
@ 2017-07-11 10:38 ` Lorenzo Pieralisi
  2017-07-12 17:55 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2017-07-11 10:38 UTC (permalink / raw)
  To: Shawn Lin
  Cc: Bjorn Helgaas, linux-pci, linux-rockchip, Brian Norris,
	Jeffy Chen

On Tue, Jul 11, 2017 at 06:15:08PM +0800, Shawn Lin wrote:
> It's wrong to check the return value of pci_scan_root_bus_bridge
> here by using (!err) as 0 means it successfully scans the root
> bridge. So the probe process will be terminated mistakenly.
> 
> Fixes: ae13cb9b ("PCI: rockchip: Convert PCI scan API to ...")
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
>  drivers/pci/host/pcie-rockchip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Apologies, it is obviously a typo - before the check was

if (!bus)

which was prone to this mistake, I checked all other host bridges and
they should be ok.

Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

> diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> index 5acf869..7bb9870 100644
> --- a/drivers/pci/host/pcie-rockchip.c
> +++ b/drivers/pci/host/pcie-rockchip.c
> @@ -1483,7 +1483,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
>  	bridge->swizzle_irq = pci_common_swizzle;
>  
>  	err = pci_scan_root_bus_bridge(bridge);
> -	if (!err)
> +	if (err < 0)
>  		goto err_free_res;
>  
>  	bus = bridge->bus;
> -- 
> 1.9.1
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: rockchip: fix wrong check of pci_scan_root_bus_bridge
  2017-07-11 10:15 [PATCH] PCI: rockchip: fix wrong check of pci_scan_root_bus_bridge Shawn Lin
  2017-07-11 10:38 ` Lorenzo Pieralisi
@ 2017-07-12 17:55 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2017-07-12 17:55 UTC (permalink / raw)
  To: Shawn Lin
  Cc: Bjorn Helgaas, linux-pci, linux-rockchip, Brian Norris,
	Jeffy Chen, Lorenzo Pieralisi

On Tue, Jul 11, 2017 at 06:15:08PM +0800, Shawn Lin wrote:
> It's wrong to check the return value of pci_scan_root_bus_bridge
> here by using (!err) as 0 means it successfully scans the root
> bridge. So the probe process will be terminated mistakenly.
> 
> Fixes: ae13cb9b ("PCI: rockchip: Convert PCI scan API to ...")
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Applied with Lorenzo's ack to for-linus for v4.13, thanks!

> ---
> 
>  drivers/pci/host/pcie-rockchip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c
> index 5acf869..7bb9870 100644
> --- a/drivers/pci/host/pcie-rockchip.c
> +++ b/drivers/pci/host/pcie-rockchip.c
> @@ -1483,7 +1483,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
>  	bridge->swizzle_irq = pci_common_swizzle;
>  
>  	err = pci_scan_root_bus_bridge(bridge);
> -	if (!err)
> +	if (err < 0)
>  		goto err_free_res;
>  
>  	bus = bridge->bus;
> -- 
> 1.9.1
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-12 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-11 10:15 [PATCH] PCI: rockchip: fix wrong check of pci_scan_root_bus_bridge Shawn Lin
2017-07-11 10:38 ` Lorenzo Pieralisi
2017-07-12 17:55 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).