From: sashiko-bot@kernel.org
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: neil.armstrong@linaro.org, olteanv@gmail.com,
wsa+renesas@sang-engineering.com, vkoul@kernel.org,
linux-phy@lists.infradead.org
Subject: Re: [PATCH] phy: renesas: rcar-gen3-usb2: Keep OTG VBUS disabled until role is known
Date: Mon, 05 Oct 2026 15:58:31 +0000 [thread overview]
Message-ID: <20261005155831.C9A271F00893@smtp.kernel.org> (raw)
In-Reply-To: <20261005154841.168047-1-prabhakar.mahadev-lad.rj@bp.renesas.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] phy: renesas: unbalanced regulator disable and probe failure on external VBUS
--
commit 0b0e5d91d1d9b6894fe5132f084e7da147246f55
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
phy: renesas: rcar-gen3-usb2: Keep OTG VBUS disabled until role is known
Prevent the OTG PHY from driving VBUS during probe, as the port role has
not yet been determined and doing so can back-power an external host.
> diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> index b5ba751805aae..08db619a43a03 100644
> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
[ ... ]
> @@ -1133,15 +1133,27 @@ static int rcar_gen3_phy_usb2_vbus_regulator_get_exclusive_enable(struct rcar_ge
> return 0;
> }
>
> - if (enable) {
> + if (acquire) {
> ret = regulator_enable(channel->vbus);
> if (ret)
> return ret;
> }
>
> - if (regulator_is_enabled(channel->vbus))
> + if (regulator_is_enabled(channel->vbus)) {
> + /*
> + * The internal regulator is enabled above only so that the regulator
> + * core holds a reference to it. Do not drive VBUS until the port's
> + * role is known; rcar_gen3_enable_vbus_ctrl() switches it from then on.
> + */
> + ret = regulator_hardware_enable(channel->vbus, false);
> + if (ret) {
> + regulator_disable(channel->vbus);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Severity: High]
Does this error path trigger an unbalanced regulator disable warning?
If rcar_gen3_phy_usb2_vbus_regulator_get_exclusive() is called with
acquire = false when using an external VBUS regulator, regulator_enable() is
bypassed and the consumer's enable_count remains 0.
If the external regulator is already physically enabled (e.g. by the
bootloader), regulator_is_enabled() will return true.
If regulator_hardware_enable(channel->vbus, false) is not supported by the
external regulator (e.g. fixed regulators without GPIO), it returns
-EOPNOTSUPP, taking this error path.
Since the regulator was never enabled by this driver, won't calling
regulator_disable() here trigger an unbalanced disable warning and abort
the probe entirely?
Similarly, if regulator_hardware_enable() succeeds, devm_add_action_or_reset()
registers rcar_gen3_phy_usb2_vbus_disable_action. Since that action calls
regulator_disable(), will it cause the same unbalanced warning when the
driver unbinds?
> + return ret;
> + }
> +
> return devm_add_action_or_reset(dev, rcar_gen3_phy_usb2_vbus_disable_action,
> channel->vbus);
> + }
>
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261005154841.168047-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
prev parent reply other threads:[~2026-10-05 15:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 15:48 [PATCH] phy: renesas: rcar-gen3-usb2: Keep OTG VBUS disabled until role is known Prabhakar
2026-10-05 15:58 ` 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=20261005155831.C9A271F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=prabhakar.csengg@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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