linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] PCI: tegra: Fix the error return code in tegra_pcie_dw_probe()
@ 2019-08-22  2:03 Wei Yongjun
  2019-08-22  4:18 ` Vidya Sagar
  2019-08-22  9:54 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2019-08-22  2:03 UTC (permalink / raw)
  To: Lorenzo Pieralisi, Bjorn Helgaas, Thierry Reding,
	Jonathan Hunter, Vidya Sagar
  Cc: Wei Yongjun, linux-pci, linux-tegra, kernel-janitors

Fix the error return code in tegra_pcie_dw_probe() by using error code
instead of PTR_ERR(NULL) which is always 0.

Fixes: 6404441c8e13 ("PCI: tegra: Add Tegra194 PCIe support")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/pci/controller/dwc/pcie-tegra194.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index fc0dbeb31d78..678a6b51c7aa 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -1384,7 +1384,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
 						      "appl");
 	if (!pcie->appl_res) {
 		dev_err(dev, "Failed to find \"appl\" region\n");
-		return PTR_ERR(pcie->appl_res);
+		return -ENODEV;
 	}
 
 	pcie->appl_base = devm_ioremap_resource(dev, pcie->appl_res);
@@ -1400,7 +1400,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
 
 	phys = devm_kcalloc(dev, pcie->phy_count, sizeof(*phys), GFP_KERNEL);
 	if (!phys)
-		return PTR_ERR(phys);
+		return -ENOMEM;
 
 	for (i = 0; i < pcie->phy_count; i++) {
 		name = kasprintf(GFP_KERNEL, "p2u-%u", i);
@@ -1422,7 +1422,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
 	dbi_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
 	if (!dbi_res) {
 		dev_err(dev, "Failed to find \"dbi\" region\n");
-		return PTR_ERR(dbi_res);
+		return -ENODEV;
 	}
 	pcie->dbi_res = dbi_res;
 
@@ -1437,7 +1437,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
 						   "atu_dma");
 	if (!atu_dma_res) {
 		dev_err(dev, "Failed to find \"atu_dma\" region\n");
-		return PTR_ERR(atu_dma_res);
+		return -ENODEV;
 	}
 	pcie->atu_dma_res = atu_dma_res;




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

* Re: [PATCH -next] PCI: tegra: Fix the error return code in tegra_pcie_dw_probe()
  2019-08-22  2:03 [PATCH -next] PCI: tegra: Fix the error return code in tegra_pcie_dw_probe() Wei Yongjun
@ 2019-08-22  4:18 ` Vidya Sagar
  2019-08-22  9:54 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Vidya Sagar @ 2019-08-22  4:18 UTC (permalink / raw)
  To: Wei Yongjun, Lorenzo Pieralisi, Bjorn Helgaas, Thierry Reding,
	Jonathan Hunter
  Cc: linux-pci, linux-tegra, kernel-janitors

On 8/22/2019 7:33 AM, Wei Yongjun wrote:
> Fix the error return code in tegra_pcie_dw_probe() by using error code
> instead of PTR_ERR(NULL) which is always 0.
> 
> Fixes: 6404441c8e13 ("PCI: tegra: Add Tegra194 PCIe support")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>   drivers/pci/controller/dwc/pcie-tegra194.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
> index fc0dbeb31d78..678a6b51c7aa 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -1384,7 +1384,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
>   						      "appl");
>   	if (!pcie->appl_res) {
>   		dev_err(dev, "Failed to find \"appl\" region\n");
> -		return PTR_ERR(pcie->appl_res);
> +		return -ENODEV;
>   	}
>   
>   	pcie->appl_base = devm_ioremap_resource(dev, pcie->appl_res);
> @@ -1400,7 +1400,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
>   
>   	phys = devm_kcalloc(dev, pcie->phy_count, sizeof(*phys), GFP_KERNEL);
>   	if (!phys)
> -		return PTR_ERR(phys);
> +		return -ENOMEM;
>   
>   	for (i = 0; i < pcie->phy_count; i++) {
>   		name = kasprintf(GFP_KERNEL, "p2u-%u", i);
> @@ -1422,7 +1422,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
>   	dbi_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
>   	if (!dbi_res) {
>   		dev_err(dev, "Failed to find \"dbi\" region\n");
> -		return PTR_ERR(dbi_res);
> +		return -ENODEV;
>   	}
>   	pcie->dbi_res = dbi_res;
>   
> @@ -1437,7 +1437,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
>   						   "atu_dma");
>   	if (!atu_dma_res) {
>   		dev_err(dev, "Failed to find \"atu_dma\" region\n");
> -		return PTR_ERR(atu_dma_res);
> +		return -ENODEV;
>   	}
>   	pcie->atu_dma_res = atu_dma_res;
> 
Thanks for pushing this change.
BTW, did you use any infrastructure to simulate missing entries in device-tree to
see if the driver is returning error or not? Or you found out by just reviewing the code?

Reviewed-by: Vidya Sagar <vidyas@nvidia.com>
> 
> 


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

* Re: [PATCH -next] PCI: tegra: Fix the error return code in tegra_pcie_dw_probe()
  2019-08-22  2:03 [PATCH -next] PCI: tegra: Fix the error return code in tegra_pcie_dw_probe() Wei Yongjun
  2019-08-22  4:18 ` Vidya Sagar
@ 2019-08-22  9:54 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2019-08-22  9:54 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Bjorn Helgaas, Thierry Reding, Jonathan Hunter, Vidya Sagar,
	linux-pci, linux-tegra, kernel-janitors

On Thu, Aug 22, 2019 at 02:03:52AM +0000, Wei Yongjun wrote:
> Fix the error return code in tegra_pcie_dw_probe() by using error code
> instead of PTR_ERR(NULL) which is always 0.
> 
> Fixes: 6404441c8e13 ("PCI: tegra: Add Tegra194 PCIe support")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/pci/controller/dwc/pcie-tegra194.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Squashed in the original commit and re-pushed out my pci/tegra branch,
thank you.

Lorenzo

> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
> index fc0dbeb31d78..678a6b51c7aa 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -1384,7 +1384,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
>  						      "appl");
>  	if (!pcie->appl_res) {
>  		dev_err(dev, "Failed to find \"appl\" region\n");
> -		return PTR_ERR(pcie->appl_res);
> +		return -ENODEV;
>  	}
>  
>  	pcie->appl_base = devm_ioremap_resource(dev, pcie->appl_res);
> @@ -1400,7 +1400,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
>  
>  	phys = devm_kcalloc(dev, pcie->phy_count, sizeof(*phys), GFP_KERNEL);
>  	if (!phys)
> -		return PTR_ERR(phys);
> +		return -ENOMEM;
>  
>  	for (i = 0; i < pcie->phy_count; i++) {
>  		name = kasprintf(GFP_KERNEL, "p2u-%u", i);
> @@ -1422,7 +1422,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
>  	dbi_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
>  	if (!dbi_res) {
>  		dev_err(dev, "Failed to find \"dbi\" region\n");
> -		return PTR_ERR(dbi_res);
> +		return -ENODEV;
>  	}
>  	pcie->dbi_res = dbi_res;
>  
> @@ -1437,7 +1437,7 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
>  						   "atu_dma");
>  	if (!atu_dma_res) {
>  		dev_err(dev, "Failed to find \"atu_dma\" region\n");
> -		return PTR_ERR(atu_dma_res);
> +		return -ENODEV;
>  	}
>  	pcie->atu_dma_res = atu_dma_res;
> 
> 
> 

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

end of thread, other threads:[~2019-08-22  9:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22  2:03 [PATCH -next] PCI: tegra: Fix the error return code in tegra_pcie_dw_probe() Wei Yongjun
2019-08-22  4:18 ` Vidya Sagar
2019-08-22  9:54 ` Lorenzo Pieralisi

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