Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v2] PCI: fu740: Check return value of clk_prepare_enable()
@ 2026-12-01 19:22 Jayaraj Devaraj
  2026-12-01 19:28 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Jayaraj Devaraj @ 2026-12-01 19:22 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Krzysztof Wilczyński,
	Lorenzo Pieralisi, Bjorn Helgaas
  Cc: Paul Walmsley, Greentime Hu, Samuel Holland, Rob Herring,
	Philipp Zabel, linux-pci, linux-riscv, linux-kernel,
	Jayaraj Devaraj

fu740_pcie_host_init() ignores the return value of the second
clk_prepare_enable() call on pcie_aux, so a failure to enable the
clock is silently ignored and the controller is programmed anyway.

Check the return value and propagate the error.

Fixes: e7e21b3a339b ("PCI: fu740: Add SiFive FU740 PCIe host controller driver")
Signed-off-by: Jayaraj Devaraj <jayarajdmit@gmail.com>
---
Changes in v2:
- Add Fixes: tag.
- Rebase on pci/next.

 drivers/pci/controller/dwc/pcie-fu740.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-fu740.c b/drivers/pci/controller/dwc/pcie-fu740.c
index 00ec69a09164..b2eded23b52c 100644
--- a/drivers/pci/controller/dwc/pcie-fu740.c
+++ b/drivers/pci/controller/dwc/pcie-fu740.c
@@ -270,7 +270,11 @@ static int fu740_pcie_host_init(struct dw_pcie_rp *pp)
 	/* Clear hold_phy_rst */
 	writel_relaxed(0x0, afp->mgmt_base + PCIEX8MGMT_APP_HOLD_PHY_RST);
 	/* Enable pcieauxclk */
-	clk_prepare_enable(afp->pcie_aux);
+	ret = clk_prepare_enable(afp->pcie_aux);
+	if (ret) {
+		dev_err(dev, "unable to re-enable pcie_aux clock\n");
+		return ret;
+	}
 	/* Set RC mode */
 	writel_relaxed(0x4, afp->mgmt_base + PCIEX8MGMT_DEVICE_TYPE);
 
-- 
2.34.1


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

* Re: [PATCH v2] PCI: fu740: Check return value of clk_prepare_enable()
  2026-12-01 19:22 [PATCH v2] PCI: fu740: Check return value of clk_prepare_enable() Jayaraj Devaraj
@ 2026-12-01 19:28 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-01 19:28 UTC (permalink / raw)
  To: Jayaraj Devaraj; +Cc: linux-pci

> fu740_pcie_host_init() ignores the return value of the second
> clk_prepare_enable() call on pcie_aux, so a failure to enable the
> clock is silently ignored and the controller is programmed anyway.
> 
> Check the return value and propagate the error.
> 
> Fixes: e7e21b3a339b ("PCI: fu740: Add SiFive FU740 PCIe host controller driver")
> Signed-off-by: Jayaraj Devaraj <jayarajdmit@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201192218.35189-1-jayarajdmit@gmail.com?part=1

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

end of thread, other threads:[~2026-12-01 19:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 19:22 [PATCH v2] PCI: fu740: Check return value of clk_prepare_enable() Jayaraj Devaraj
2026-12-01 19:28 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox