[RFC PATCH] phy: qcom: ipq4019-usb: Propagate reset operation failures

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Aug 28 02:30:22 PDT 2026


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 at 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



More information about the linux-phy mailing list