From: sashiko-bot@kernel.org
To: "Michal Wilczynski" <m.wilczynski@samsung.com>
Cc: mfd@lists.linux.dev, linux-phy@lists.infradead.org,
neil.armstrong@linaro.org, linux-clk@vger.kernel.org,
conor+dt@kernel.org, dri-devel@lists.freedesktop.org,
devicetree@vger.kernel.org, lee@kernel.org, olteanv@gmail.com,
vkoul@kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 13/15] phy: starfive: Add jh7110-inno-hdmi-phy driver
Date: Fri, 28 Aug 2026 14:04:49 +0000 [thread overview]
Message-ID: <20260828140450.66CAE1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260828-jh7110-clean-send-v2-13-331680c8b9d1@samsung.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Missing cleanup on the clk_set_rate error path in probe leaves a dangling clock provider.
- [High] Clock operations incorrectly modify analog PHY state without synchronization, risking state corruption and power leaks.
- [Medium] Hardware PHY resources are left powered on if starfive_hdmi_phy_power_on() fails.
--
commit 7c46f9e86f09391b8c542e940da1457e36661874
Author: Michal Wilczynski <m.wilczynski@samsung.com>
phy: starfive: Add jh7110-inno-hdmi-phy driver
This commit adds the HDMI PHY driver for the StarFive JH7110. It provides
the variable pixel clock from the Pre-PLL and the PHY operations for the
Post-PLL and analog blocks.
> diff --git a/drivers/phy/starfive/phy-jh7110-inno-hdmi.c b/drivers/phy/starfive/phy-jh7110-inno-hdmi.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/phy/starfive/phy-jh7110-inno-hdmi.c
[ ... ]
> +static int starfive_hdmi_phy_clk_set_rate(struct clk_hw *hw, unsigned long rate,
> + unsigned long parent_rate)
> +{
[ ... ]
> + if (inno->pixclock == rate && inno->tmdsclock == cfg->tmdsclock)
> + return 0;
> +
> + inno_update_bits(inno, STF_INNO_BIAS_CONTROL,
> + STF_INNO_BIAS_ENABLE, STF_INNO_BIAS_ENABLE);
> + inno_write(inno, STF_INNO_RX_CONTROL, STF_INNO_RX_ENABLE);
[Severity: High]
Does this incorrectly modify analog PHY state during clock operations?
Since clk_set_rate() is unconditionally called during starfive_hdmi_phy_probe(),
these analog blocks are powered on immediately at boot, which could cause a
permanent power leak until the power_off callback happens to be called.
Furthermore, do these state modifications race with the PHY callbacks? The
common clock framework callbacks execute under the CCF prepare_lock, while PHY
callbacks execute under the phy->mutex lock. A concurrent clk_set_rate() and
starfive_hdmi_phy_power_on() could race on hardware registers and shared driver
state like inno->pixclock.
[ ... ]
> +static int starfive_hdmi_phy_power_on(struct phy *phy)
> +{
[ ... ]
> + inno_write(inno, STF_INNO_POST_PLL_DIV_1, reg_1aa_value);
> +
> + /* Wait for post PLL lock */
> + ret = inno_poll(inno, STF_INNO_POST_PLL_LOCK_STATUS, v,
> + v & STF_INNO_POST_PLL_LOCK, 1000, 100000);
> + if (ret) {
> + dev_err(inno->dev, "Post-PLL locking failed\n");
> + return ret;
> + }
[Severity: Medium]
Are the hardware PHY resources left powered on if the Post-PLL lock times out?
If inno_poll() fails, the function returns immediately. The PHY core framework
does not automatically call the power_off callback if the power_on callback
fails, because the power_count remains 0.
Does this error path need to explicitly undo the register writes that enabled
the BIAS, RX, and Post-PLL blocks earlier in this function?
[ ... ]
> +static int starfive_hdmi_phy_probe(struct platform_device *pdev)
> +{
[ ... ]
> + ret = clk_set_rate(inno->phyclk, 297000000);
> + if (ret) {
> + dev_err(dev, "Failed to set default rate: %d\n", ret);
> + goto err_disable_refoclk;
> + }
[ ... ]
> +err_del_clk_provider:
> + of_clk_del_provider(dev->of_node);
> +err_disable_refoclk:
> + clk_disable_unprepare(inno->refoclk);
> + return ret;
> +}
[Severity: High]
Does this error path leave a dangling clock provider in the global list?
If clk_set_rate() fails, the code jumps to err_disable_refoclk, bypassing
the required of_clk_del_provider() cleanup. The devres framework will then
unregister and free inno->phyclk, but the device node will remain in the
system-wide of_clk_providers list pointing to freed memory. Any subsequent
clock lookup could trigger a use-after-free crash.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260828-jh7110-clean-send-v2-0-331680c8b9d1@samsung.com?part=13
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-08-28 14:04 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260828134813eucas1p1bd003a66706ed251017185fc14f13cc9@eucas1p1.samsung.com>
2026-08-28 13:47 ` [PATCH v2 00/15] drm: starfive: jh7110: Enable display subsystem Michal Wilczynski
2026-08-28 13:47 ` [PATCH v2 01/15] dt-bindings: phy: Add starfive,jh7110-inno-hdmi-phy Michal Wilczynski
2026-08-28 13:54 ` sashiko-bot
2026-08-28 16:43 ` Conor Dooley
2026-08-28 13:47 ` [PATCH v2 02/15] dt-bindings: display: bridge: Add starfive,jh7110-inno-hdmi-controller Michal Wilczynski
2026-08-28 13:54 ` sashiko-bot
2026-08-28 14:04 ` Icenowy Zheng
2026-08-28 16:47 ` Conor Dooley
2026-08-28 13:47 ` [PATCH v2 03/15] dt-bindings: mfd: Add starfive,jh7110-hdmi-subsystem Michal Wilczynski
2026-08-28 13:54 ` sashiko-bot
2026-08-28 16:50 ` Conor Dooley
2026-08-28 13:47 ` [PATCH v2 04/15] drm/bridge: inno-hdmi: Split probe out of bind Michal Wilczynski
2026-08-28 14:01 ` sashiko-bot
2026-08-28 13:47 ` [PATCH v2 05/15] drm/bridge: inno-hdmi: Allow the register map to come from a parent Michal Wilczynski
2026-08-28 13:54 ` sashiko-bot
2026-08-28 13:47 ` [PATCH v2 06/15] drm/bridge: inno-hdmi: Add .disable platform operation Michal Wilczynski
2026-08-28 13:57 ` sashiko-bot
2026-08-28 13:47 ` [PATCH v2 07/15] drm/bridge: inno-hdmi: Add .mode_valid " Michal Wilczynski
2026-08-28 13:52 ` sashiko-bot
2026-08-28 13:47 ` [PATCH v2 08/15] soc: starfive: Add jh7110-hdmi-subsystem driver Michal Wilczynski
2026-08-28 13:59 ` sashiko-bot
2026-08-28 13:47 ` [PATCH v2 09/15] clk: starfive: jh7110-vout: Allow pixel clock rate propagation Michal Wilczynski
2026-08-28 14:01 ` sashiko-bot
2026-08-28 13:47 ` [PATCH v2 10/15] drm/bridge: starfive: Add JH7110 HDMI controller driver Michal Wilczynski
2026-08-28 13:59 ` sashiko-bot
2026-08-28 13:47 ` [PATCH v2 11/15] phy: Add common Innosilicon HDMI PHY helpers Michal Wilczynski
2026-08-28 14:00 ` sashiko-bot
2026-08-28 13:47 ` [PATCH v2 12/15] phy: rockchip: inno-hdmi: Use the common Innosilicon " Michal Wilczynski
2026-08-28 14:12 ` sashiko-bot
2026-08-28 13:47 ` [PATCH v2 13/15] phy: starfive: Add jh7110-inno-hdmi-phy driver Michal Wilczynski
2026-08-28 14:04 ` sashiko-bot [this message]
2026-08-28 13:47 ` [PATCH v2 14/15] riscv: dts: starfive: jh7110: Update DT for display subsystem Michal Wilczynski
2026-08-28 14:06 ` sashiko-bot
2026-08-28 14:06 ` Icenowy Zheng
2026-08-28 13:47 ` [PATCH v2 15/15] MAINTAINERS: Add StarFive JH7110 display subsystem entry Michal Wilczynski
2026-08-28 14:01 ` Icenowy Zheng
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=20260828140450.66CAE1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lee@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=m.wilczynski@samsung.com \
--cc=mfd@lists.linux.dev \
--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