kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][V2][next] PCI: brcmstb: fix a missing if statement on a return error check
@ 2020-09-21 21:15 Colin King
  0 siblings, 0 replies; only message in thread
From: Colin King @ 2020-09-21 21:15 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Lorenzo Pieralisi, Rob Herring,
	Bjorn Helgaas, Florian Fainelli, bcm-kernel-feedback-list,
	Jim Quinlan, linux-rpi-kernel, linux-arm-kernel, linux-pci
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---

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(+)

diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
index 7a3ff4632e7c..25f46f87b36f 100644
--- a/drivers/pci/controller/pcie-brcmstb.c
+++ b/drivers/pci/controller/pcie-brcmstb.c
@@ -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);
-- 
2.27.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-21 21:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 21:15 [PATCH][V2][next] PCI: brcmstb: fix a missing if statement on a return error check Colin King

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