From: sashiko-bot@kernel.org
To: "Jayaraj Devaraj" <jayarajdmit@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: fu740: Check return value of clk_prepare_enable()
Date: Mon, 16 Nov 2026 21:03:50 +0000 [thread overview]
Message-ID: <sashiko-outbox-217689@kernel.org> (raw)
In-Reply-To: <20261116204922.159384-1-jayarajdmit@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] PCI: fu740: missing Fixes trailer forfu740_pcie_host_init()
clock check
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [Medium] PCI: fu740: missing .deinit cleanup and unchecked
clk_prepare_enable() [1]
--
commit 04ba94c4c15cc3b4e7a1a6837f3336a1c0b55bce
Author: Jayaraj Devaraj <jayarajdmit@gmail.com>
> PCI: fu740: Check return value of clk_prepare_enable()
>
> 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.
>
> Signed-off-by: Jayaraj Devaraj <jayarajdmit@gmail.com>
[Severity: Low]
Since this fixes a missing error check in fu740_pcie_host_init(), should it
include:
Fixes: e7e21b3a339b ("PCI: fu740: Add SiFive FU740 PCIe host controller driver")
> diff --git a/drivers/pci/controller/dwc/pcie-fu740.c b/drivers/pci/controller/dwc/pcie-fu740.c
> index 4908077e58c4c..c9bb4c4fba23f 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);
>
[Severity: Medium]
This problem wasn't introduced by this patch, but does returning here or
failing later in dw_pcie_host_init() leak the clock and reset state
[1]?
Earlier in fu740_pcie_host_init(), reset_control_deassert(afp->rst)
deasserts the reset line, so returning when the second
clk_prepare_enable(afp->pcie_aux) fails leaves afp->rst deasserted.
In addition, fu740_pcie_host_ops has no .deinit callback, so if a later
step in dw_pcie_host_init() fails after fu740_pcie_host_init() succeeds,
afp->pcie_aux remains enabled and afp->rst remains deasserted.
[1] https://sashiko.dev/#/bug/linux-e8a8fccf-83d6-4777-a6b0-51ba01cc3409
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116204922.159384-1-jayarajdmit@gmail.com?part=1
prev parent reply other threads:[~2026-11-16 21:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 20:49 [PATCH] PCI: fu740: Check return value of clk_prepare_enable() Jayaraj Devaraj
2026-11-16 20:49 ` Jayaraj Devaraj
2026-11-16 21:03 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-217689@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jayarajdmit@gmail.com \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.