From: sashiko-bot@kernel.org
To: "Mattijs Korpershoek" <mkorpershoek@kernel.org>
Cc: robh@kernel.org, conor+dt@kernel.org, vkoul@kernel.org,
linux-phy@lists.infradead.org, olteanv@gmail.com,
neil.armstrong@linaro.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P
Date: Thu, 30 Jul 2026 14:13:38 +0000 [thread overview]
Message-ID: <20260730141339.680B81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730-phy-qcom-snps-femto-v2-8255-v1-2-8b8bf5105a68@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Incorrect power domain enablement and teardown ordering in d3 <--> d0 transitions.
- [Medium] The `sa8255p_snps_hs_phy` match data is defined as a scalar struct but iterated over as an array, risking out-of-bounds memory access.
--
--- Patch [2]: [PATCH 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P ---
commit 337a4b6fa46b42e255f6aa6b19e2b52e65e59f7d
Author: Sriram Dash <quic_sriramd@quicinc.com>
phy: qcom-snps-femto-v2: Add support for SA8255P
The Qualcomm automotive SA8255p SoC relies on firmware to configure
platform resources, including clocks, interconnects and TLMM.
The driver requests resources operations over SCMI using power protocols.
> diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> index eb0b0f61d98e0..4a9bd3ae0e535 100644
> --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
[ ... ]
> @@ -136,8 +139,81 @@ struct qcom_snps_hsphy {
> +/* d3_to_d0 transition by turning on all the suppliers */
> +static int qcom_snps_d3_to_d0(struct qcom_snps_hsphy *hsphy)
> +{
> + int ret;
> +
> + if (!hsphy->pd_list)
> + return 0;
> +
> + ret = pm_runtime_resume_and_get(hsphy->pd_list->pd_devs[0]);
> + if (ret)
> + return ret;
> +
> + ret = pm_runtime_resume_and_get(hsphy->pd_list->pd_devs[1]);
> + if (ret)
> + pm_runtime_put_sync(hsphy->pd_list->pd_devs[0]);
> +
> + return ret;
> +}
[Severity: High]
Does this resume the power domains in the correct order?
The commit message states that the power domain 'core' (pd_devs[1]) controls
the GDSC, and 'transfer' (pd_devs[0]) controls clocks and interconnects.
Resuming 'transfer' before 'core' means clocks are enabled without their
powering GDSC, which could cause bus hangs on Qualcomm SoCs.
Additionally, since state d1 has 'transfer' OFF and 'core' ON, shouldn't 'core'
always be enabled first and disabled last?
> +
> +/* d0_to_d3 transition by turning off all the suppliers */
> +static void qcom_snps_d0_to_d3(struct qcom_snps_hsphy *hsphy)
> +{
> + if (!hsphy->pd_list)
> + return;
> +
> + pm_runtime_put_sync(hsphy->pd_list->pd_devs[1]);
> + pm_runtime_put_sync(hsphy->pd_list->pd_devs[0]);
> +}
[Severity: High]
Should the 'transfer' domain (pd_devs[0]) be put before the 'core'
domain (pd_devs[1])?
Putting 'core' before 'transfer' disables the GDSC while the clocks are
still active.
[ ... ]
> @@ -316,6 +394,10 @@ static const struct override_param ls_fs_output_impedance_sc7280[] = {
> { 1310, 0 },
> };
>
> +static const struct override_param_map sa8255p_snps_hs_phy = {
> + .fw_managed = true,
> +};
> +
[Severity: Medium]
Will this scalar struct cause an out-of-bounds read in
qcom_snps_hsphy_read_override_param_seq()?
The match data is defined here as a single scalar struct, but
qcom_snps_hsphy_read_override_param_seq() casts the match data to an array and
iterates over it until cfg[i].prop_name != NULL:
drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c:qcom_snps_hsphy_read_override_param_seq() {
...
cfg = of_device_get_match_data(dev);
if (!cfg)
return;
for (i = 0; cfg[i].prop_name != NULL; i++) {
...
}
Currently this terminates on the first iteration because the uninitialized
.prop_name field is implicitly NULL, but if a property is ever added to this
struct in the future, it will read past the end of the struct into adjacent
memory.
Should this be defined as an array with an empty sentinel element like the
other param maps?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730-phy-qcom-snps-femto-v2-8255-v1-0-8b8bf5105a68@kernel.org?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
prev parent reply other threads:[~2026-07-30 14:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 13:58 [PATCH 0/2] Add support for SA8255P in the phy-qcom-snps-femto-v2 phy driver Mattijs Korpershoek
2026-07-30 13:58 ` [PATCH 1/2] dt-bindings: phy: Add sa8255p high-speed USB PHY Mattijs Korpershoek
2026-07-30 14:06 ` sashiko-bot
2026-07-30 14:13 ` Mattijs Korpershoek
2026-07-30 13:58 ` [PATCH 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P Mattijs Korpershoek
2026-07-30 14:13 ` 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=20260730141339.680B81F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=mkorpershoek@kernel.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