Skip to contentSkip to conversation

PCI: brcmstb: fix a missing if statement on a return error check

PATCH New Colin King 1 participant 1 message Sep 21, 2020

Subsystems (6)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH v2 1/1 PCI: brcmstb: fix a missing if statement on a return error check

From: Colin Ian King <[email protected]>

The error return ret is not being check with an if statement and currently the code always returns leaving the following code as dead code. Fix this by adding in the missing if statement and clean up with the clk_disable_unprepare call.

Kudos to Florian Fainelli for noting that the clock needed disabling.

Addresses-Coverity: ("Structurally dead code")

Fixes ad3d29c77e1e ("PCI: brcmstb: Add control of rescal reset")

---

V2: disable clock as noted by Florian Fainelli and suggested by
Jim Quinlan.

---
 drivers/pci/controller/pcie-brcmstb.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/pci/controller/pcie-brcmstb.c +3 -0
index 7a3ff4632e7c..25f46f87b36f 100644
@@ -1154,7 +1154,10 @@ static int brcm_pcie_resume(struct device *dev)
 	clk_prepare_enable(pcie->clk);
 
 	ret = brcm_phy_start(pcie);
+	if (ret) {
+		clk_disable_unprepare(pcie->clk);
 		return ret;
+	}
 
 	/* Take bridge out of reset so we can access the SERDES reg */
 	pcie->bridge_sw_init_set(pcie, 0);
Signature · 1 line
2.27.0