From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: neil.armstrong@linaro.org, vkoul@kernel.org, olteanv@gmail.com,
linux-phy@lists.infradead.org
Subject: Re: [PATCH v2 4/4] phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576
Date: Thu, 01 Oct 2026 13:23:46 +0000 [thread overview]
Message-ID: <20261001132347.49BD61F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261001-phy-rockchip-inno-usb2-clock-fix-v2-4-e01bf509359e@collabora.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] usb: phy: rockchip: NULL ptr deref in clk480m_prepare due to early clock registration
- [Medium] usb: phy: rockchip: missing hardware rollback on clk prepare error
--
commit eaaff48582a4fba9285d43555bb9babaac779141
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576
This commit modifies the RK3588/RK3576 USB2 PHY driver to fully power the PHY
during clock prepare operations. It addresses an issue during OHCI system
resume where the PHY must be running to access controller registers, moving the
suspend handling directly into the clock prepare/unprepare hooks.
> diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> index 925a03fee6bc5..cc923d12ef7b4 100644
> --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
> +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
[ ... ]
> @@ -379,16 +381,27 @@ static int rockchip_usb2phy_clk480m_prepare(struct clk_hw *hw)
> usleep_range(1200, 1300);
> }
>
> + if (rphy->phy_cfg->num_ports == 1) {
> + ret = rockchip_usb2phy_set_suspend(rphy, &rphy->ports[0], false);
[Severity: High]
Could this lead to a null pointer dereference during probe?
In rockchip_usb2phy_probe(), the clock is registered via
rockchip_usb2phy_clk480m_register() before iterating over child nodes to
initialize the ports array and configurations.
If a concurrent or deferred probe from a clock consumer (such as the OHCI
controller) requests and prepares the clock immediately, this is called before
port initialization finishes.
At this point, rport->port_cfg will be NULL, which leads to a null pointer
dereference when property_enable() attempts to access
&rport->port_cfg->phy_sus.
> + if (ret)
> + return ret;
[Severity: Medium]
If rockchip_usb2phy_set_suspend() fails here, does this leave the clock
output permanently enabled?
Earlier in rockchip_usb2phy_clk480m_prepare(), the clock output is turned on
using property_enable().
Since the Common Clock Framework aborts preparation on error, .unprepare
will never be called to clean it up.
Returning immediately without rolling back the earlier hardware state change
appears to leave the clock output enabled.
> + }
> +
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001-phy-rockchip-inno-usb2-clock-fix-v2-0-e01bf509359e@collabora.com?part=4
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-10-01 13:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 13:12 [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
2026-10-01 13:12 ` [PATCH v2 1/4] phy: rockchip: inno-usb2: simplify and unify PHY op debug messages Sebastian Reichel
2026-10-01 13:12 ` [PATCH v2 2/4] phy: rockchip: inno-usb2: drop duplicated update of rport->suspended Sebastian Reichel
2026-10-01 13:23 ` sashiko-bot
2026-10-01 13:12 ` [PATCH v2 3/4] phy: rockchip: inno-usb2: move suspend handling into new function Sebastian Reichel
2026-10-01 13:21 ` sashiko-bot
2026-10-01 13:12 ` [PATCH v2 4/4] phy: rockchip: inno-usb2: move suspend handling into clock prepare/unprepare for RK3588/RK3576 Sebastian Reichel
2026-10-01 13:23 ` sashiko-bot [this message]
2026-10-01 21:34 ` [PATCH v2 0/4] phy: rockchip: inno-usb2: ensure PHY is running when clock is requested Sebastian Reichel
2026-10-03 14:33 ` Vinod Koul
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=20261001132347.49BD61F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sebastian.reichel@collabora.com \
--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;
as well as URLs for NNTP newsgroup(s).