Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Konrad Dybcio" <konradybcio@kernel.org>
Cc: neil.armstrong@linaro.org, vkoul@kernel.org, olteanv@gmail.com,
	robh@kernel.org, linux-phy@lists.infradead.org,
	conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 5/5] arm64: dts: qcom: hamoa: Extend QMPPHY description for USB4
Date: Thu, 30 Jul 2026 14:31:06 +0000	[thread overview]
Message-ID: <20260730143107.9E00D1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260730-topic-usb4phy-v3-5-ccf0f7ea98b5@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] A resource leak is present in `qmp_combo_usb4_init()` (introduced by a previous patch in this series) and is exposed when this DT patch provides the missing `p2rr2p_pipe` clock. If `clk_prepare_enable(qmp->p2rr2p_pipe_clk)` succeeds, the function may later fail during `qmp_combo_com_init()`, `qmp_combo_reconfigure_phy()`, or `qmp_combo_usb_power_on()`. On these error paths, the function returns without calling `clk_disable_unprepare(qmp->p2rr2p_pipe_clk)`, leaking the clock reference.
--

--- Patch [5]: [PATCH v3 5/5] arm64: dts: qcom: hamoa: Extend QMPPHY description for USB4 ---
commit f94fbc66a74d14588b2084c9550548446b3f5825
Author: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

arm64: dts: qcom: hamoa: Extend QMPPHY description for USB4

This commit extends the QMPPHY description for USB4 by adding the missing 
GCC_USB4_X_PHY_P2RR2P_PIPE_CLK clock. This additional clock is required 
for the PHY to initialize successfully.

> diff --git a/arch/arm64/boot/dts/qcom/hamoa.dtsi b/arch/arm64/boot/dts/qcom/hamoa.dtsi
> index 09527dcf95767..2effc0319a01a 100644
> --- a/arch/arm64/boot/dts/qcom/hamoa.dtsi
> +++ b/arch/arm64/boot/dts/qcom/hamoa.dtsi
> @@ -2825,11 +2825,13 @@ usb_1_ss0_qmpphy: phy@fd5000 {
>  			clocks = <&gcc GCC_USB3_PRIM_PHY_AUX_CLK>,
>  				 <&rpmhcc RPMH_CXO_CLK>,
>  				 <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>,
> -				 <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>;
> +				 <&gcc GCC_USB3_PRIM_PHY_PIPE_CLK>,
> +				 <&gcc GCC_USB4_0_PHY_P2RR2P_PIPE_CLK>;
>  			clock-names = "aux",
>  				      "ref",
>  				      "com_aux",
> -				      "usb3_pipe";
> +				      "usb3_pipe",
> +				      "p2rr2p_pipe";

[Severity: Medium]
This isn't a bug introduced by this device tree patch itself, but providing
this missing p2rr2p_pipe clock exposes a resource leak in the driver's
error path.

If the call to clk_prepare_enable(qmp->p2rr2p_pipe_clk) succeeds in
qmp_combo_usb4_init():

drivers/phy/qualcomm/phy-qcom-qmp-combo.c:qmp_combo_usb4_init() {
    ...
	ret = clk_prepare_enable(qmp->p2rr2p_pipe_clk);
	if (ret) {
		dev_err(qmp->dev, "p2rr2p_pipe enable failed: %d\n", ret);
		return ret;
	}

	ret = qmp_combo_com_init(qmp, false);
	if (ret)
		return ret;
    ...
	ret = qmp_combo_usb_power_on(phy);
	if (ret) {
		qmp_combo_com_exit(qmp, false);
		return ret;
	}
    ...
}

Does this code leak the p2rr2p_pipe_clk reference if qmp_combo_com_init(),
qmp_combo_reconfigure_phy(), or qmp_combo_usb_power_on() fails? 

Should it call clk_disable_unprepare(qmp->p2rr2p_pipe_clk) on these error
paths before returning?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260730-topic-usb4phy-v3-0-ccf0f7ea98b5@oss.qualcomm.com?part=5

      reply	other threads:[~2026-07-30 14:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 14:19 [PATCH v3 0/5] USB4 mode programming for QMMPHY on X1E Konrad Dybcio
2026-07-30 14:19 ` [PATCH v3 1/5] dt-bindings: phy: qcom,qmp-usb3-dp: Extend X1E description for USB4 Konrad Dybcio
2026-07-30 14:33   ` sashiko-bot
2026-07-30 14:19 ` [PATCH v3 2/5] phy: core: Define TBT phy_mode Konrad Dybcio
2026-07-30 14:19 ` [PATCH v3 3/5] phy: qualcomm: qmp-combo: Add preliminary USB4 support Konrad Dybcio
2026-07-30 14:38   ` sashiko-bot
2026-07-30 14:19 ` [PATCH v3 4/5] phy: qualcomm: qmp-combo: Add USB4/TBT3 configuration data for Hamoa Konrad Dybcio
2026-07-30 14:44   ` sashiko-bot
2026-07-30 14:19 ` [PATCH v3 5/5] arm64: dts: qcom: hamoa: Extend QMPPHY description for USB4 Konrad Dybcio
2026-07-30 14:31   ` 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=20260730143107.9E00D1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox