lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e78f13a1-b035-c3b8-7aff-1eb0cd55e977@synopsys.com>
Date:   Tue, 18 Apr 2023 05:05:26 +0000
From:   Minas Harutyunyan <Minas.Harutyunyan@...opsys.com>
To:     Fabrice Gasnier <fabrice.gasnier@...s.st.com>,
        Minas Harutyunyan <Minas.Harutyunyan@...opsys.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "krzysztof.kozlowski+dt@...aro.org" 
        <krzysztof.kozlowski+dt@...aro.org>,
        "alexandre.torgue@...s.st.com" <alexandre.torgue@...s.st.com>
CC:     "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-stm32@...md-mailman.stormreply.com" 
        <linux-stm32@...md-mailman.stormreply.com>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "amelie.delaunay@...s.st.com" <amelie.delaunay@...s.st.com>
Subject: Re: [PATCH v2 1/4] usb: dwc2: improve error handling in
 __dwc2_lowlevel_hw_enable

On 4/14/23 12:41, Fabrice Gasnier wrote:
> Add error handling in __dwc2_lowlevel_hw_enable() that may leave the
> clocks and regulators enabled upon error.
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@...s.st.com>

Acked-by: Minas Harutyunyan <hminas@...opsys.com>

> ---
>   drivers/usb/dwc2/platform.c | 19 +++++++++++++++++--
>   1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index d1589ba7d322..c431ce6c119f 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -104,7 +104,7 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
>   	if (hsotg->clk) {
>   		ret = clk_prepare_enable(hsotg->clk);
>   		if (ret)
> -			return ret;
> +			goto err_dis_reg;
>   	}
>   
>   	if (hsotg->uphy) {
> @@ -113,10 +113,25 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
>   		ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
>   	} else {
>   		ret = phy_init(hsotg->phy);
> -		if (ret == 0)
> +		if (ret == 0) {
>   			ret = phy_power_on(hsotg->phy);
> +			if (ret)
> +				phy_exit(hsotg->phy);
> +		}
>   	}
>   
> +	if (ret)
> +		goto err_dis_clk;
> +
> +	return 0;
> +
> +err_dis_clk:
> +	if (hsotg->clk)
> +		clk_disable_unprepare(hsotg->clk);
> +
> +err_dis_reg:
> +	regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
> +
>   	return ret;
>   }
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ