Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pengpeng Hou" <pengpeng@iscas.ac.cn>
Cc: neil.armstrong@linaro.org, vkoul@kernel.org, olteanv@gmail.com,
	linux-phy@lists.infradead.org
Subject: Re: [RFC PATCH] phy: qcom: ipq4019-usb: Propagate reset operation failures
Date: Fri, 28 Aug 2026 09:30:22 +0000	[thread overview]
Message-ID: <20260828093023.44AE81F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260828091857.8581-1-pengpeng@iscas.ac.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly introduced error rollback in `ipq4019_hs_phy_power_off()` incorrectly deasserts `por_rst` when called from `ipq4019_hs_phy_power_on()`, corrupting the PHY state.
--

commit cf6cfeb0a60a431fc71ac93de671a2fcf94d05dc
Author: Pengpeng Hou <pengpeng@iscas.ac.cn>

phy: qcom: ipq4019-usb: Propagate reset operation failures
    
This commit propagates reset operation failures in the IPQ4019 USB PHY driver
and attempts a best-effort rollback if an operation fails.

> diff --git a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
> index da6f290af7221..8c1834cd6a8e9 100644
> --- a/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c
> +++ b/drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c

[ ... ]

> @@ -56,10 +63,20 @@ static int ipq4019_hs_phy_power_off(struct phy *_phy)
>  {
>  	struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);
>  
> -	reset_control_assert(phy->por_rst);
> +	int ret;
> +
> +	ret = reset_control_assert(phy->por_rst);
> +	if (ret)
> +		return ret;
> +
>  	msleep(10);
>  
> -	reset_control_assert(phy->srif_rst);
> +	ret = reset_control_assert(phy->srif_rst);
> +	if (ret) {
> +		reset_control_deassert(phy->por_rst);
> +		return ret;
> +	}
> +
>  	msleep(10);
>  
>  	return 0;
> @@ -69,14 +86,23 @@ static int ipq4019_hs_phy_power_on(struct phy *_phy)
>  {
>  	struct ipq4019_usb_phy *phy = phy_get_drvdata(_phy);
>  
> -	ipq4019_hs_phy_power_off(_phy);
> +	int ret;
> +
> +	ret = ipq4019_hs_phy_power_off(_phy);
> +	if (ret)
> +		return ret;

[Severity: Medium]
When ipq4019_hs_phy_power_on() calls ipq4019_hs_phy_power_off() to pulse the
reset lines, it starts from an already-off state (where por_rst is asserted).

If reset_control_assert(phy->srif_rst) fails inside ipq4019_hs_phy_power_off(),
the rollback will unconditionally call reset_control_deassert(phy->por_rst).

Does this incorrectly assume the initial state was on, leaving the hardware in
an inconsistent state (por_rst deasserted, srif_rst asserted) instead of safely
remaining in a clean off state?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260828091857.8581-1-pengpeng@iscas.ac.cn?part=1

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

      reply	other threads:[~2026-08-28  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  9:18 [RFC PATCH] phy: qcom: ipq4019-usb: Propagate reset operation failures Pengpeng Hou
2026-08-28  9:30 ` 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=20260828093023.44AE81F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=pengpeng@iscas.ac.cn \
    --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