Skip to contentSkip to conversation

PCI: uniphier: Fix some error handling in uniphier_pcie_ep_probe()

PATCH In review Dan Carpenter 3 participants 3 messages Jun 3, 2020 – Jun 4, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: uniphier: Fix some error handling in uniphier_pcie_ep_probe()

This code is checking the wrong variable. It should be checking "clk_gio" instead of "clk". The "priv->clk" pointer is NULL at this point so the condition is false.

Fixes 006564dee8253 ("PCI: uniphier: Add Socionext UniPhier Pro5 PCIe endpoint controller driver")
---
 drivers/pci/controller/dwc/pcie-uniphier-ep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-uniphier-ep.c +2 -2
index 0f36aa33d2e50..1483559600610 100644
@@ -324,8 +324,8 @@ static int uniphier_pcie_ep_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->base);
 
 	priv->clk_gio = devm_clk_get(dev, "gio");
-	if (IS_ERR(priv->clk))
-		return PTR_ERR(priv->clk);
+	if (IS_ERR(priv->clk_gio))
+		return PTR_ERR(priv->clk_gio);
 
 	priv->rst_gio = devm_reset_control_get_shared(dev, "gio");
 	if (IS_ERR(priv->rst_gio))
Signature · 1 line
2.26.2
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Dan,

Quoted 16 lines · Dan Carpenter

This code is checking the wrong variable. It should be checking "clk_gio" instead of "clk". The "priv->clk" pointer is NULL at this point so the condition is false.

Fixes 006564dee8253 ("PCI: uniphier: Add Socionext UniPhier Pro5 PCIe endpoint controller driver")
---
  drivers/pci/controller/dwc/pcie-uniphier-ep.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-uniphier-ep.c +0 -0
index 0f36aa33d2e50..1483559600610 100644

drivers/pci/controller/dwc/pcie-uniphier-ep.c static int uniphier_pcie_ep_probe(struct platform_device *pdev) · line 331

Quoted 10 lines
drivers/pci/controller/dwc/pcie-uniphier-ep.c +2 -2
@@ -324,8 +324,8 @@ static int uniphier_pcie_ep_probe(struct platform_device *pdev)
  		return PTR_ERR(priv->base);
 
  	priv->clk_gio = devm_clk_get(dev, "gio");
-	if (IS_ERR(priv->clk))
-		return PTR_ERR(priv->clk);
+	if (IS_ERR(priv->clk_gio))
+		return PTR_ERR(priv->clk_gio);
 
  	priv->rst_gio = devm_reset_control_get_shared(dev, "gio");
  	if (IS_ERR(priv->rst_gio))

Thank you for pointing out.
Certainly this is a wrong check.

Thanks,

---
Best Regards
Kunihiko Hayashi

#2 lore raw
In reply to Dan Carpenter
Quoted 9 lines · Dan Carpenter

This code is checking the wrong variable. It should be checking "clk_gio" instead of "clk". The "priv->clk" pointer is NULL at this point so the condition is false.

Fixes 006564dee8253 ("PCI: uniphier: Add Socionext UniPhier Pro5 PCIe endpoint controller driver")
---
 drivers/pci/controller/dwc/pcie-uniphier-ep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Squashed in the commit it is fixing, thanks !

Lorenzo

Quoted 18 lines
drivers/pci/controller/dwc/pcie-uniphier-ep.c +2 -2
index 0f36aa33d2e50..1483559600610 100644
@@ -324,8 +324,8 @@ static int uniphier_pcie_ep_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->base);
 
 	priv->clk_gio = devm_clk_get(dev, "gio");
-	if (IS_ERR(priv->clk))
-		return PTR_ERR(priv->clk);
+	if (IS_ERR(priv->clk_gio))
+		return PTR_ERR(priv->clk_gio);
 
 	priv->rst_gio = devm_reset_control_get_shared(dev, "gio");
 	if (IS_ERR(priv->rst_gio))
Signature · 1 line
2.26.2