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: <20230407010016.sqbxmjyegpwai7p6@synopsys.com>
Date:   Fri, 7 Apr 2023 01:00:29 +0000
From:   Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To:     Johan Hovold <johan+linaro@...nel.org>
CC:     Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 07/11] USB: dwc3: clean up phy init error handling

On Tue, Apr 04, 2023, Johan Hovold wrote:
> While there likely are no platforms out there that mix generic and
> legacy PHYs the driver should still be able to handle that, if only for
> consistency reasons.
> 
> Add the missing calls to shutdown any legacy PHYs if generic PHY
> initialisation fails.
> 
> Note that we continue to happily ignore potential errors from the legacy
> PHY callbacks...
> 
> Signed-off-by: Johan Hovold <johan+linaro@...nel.org>
> ---
>  drivers/usb/dwc3/core.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index de84e057d28b..15405f1f7aef 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1031,15 +1031,14 @@ static int dwc3_core_init(struct dwc3 *dwc)
>  
>  	usb_phy_init(dwc->usb2_phy);
>  	usb_phy_init(dwc->usb3_phy);
> +
>  	ret = phy_init(dwc->usb2_generic_phy);
>  	if (ret < 0)
> -		goto err0a;
> +		goto err_shutdown_usb3_phy;
>  
>  	ret = phy_init(dwc->usb3_generic_phy);
> -	if (ret < 0) {
> -		phy_exit(dwc->usb2_generic_phy);
> -		goto err0a;
> -	}
> +	if (ret < 0)
> +		goto err_exit_usb2_phy;
>  
>  	ret = dwc3_core_soft_reset(dwc);
>  	if (ret)
> @@ -1215,11 +1214,12 @@ static int dwc3_core_init(struct dwc3 *dwc)
>  	usb_phy_set_suspend(dwc->usb3_phy, 1);
>  
>  err1:
> -	usb_phy_shutdown(dwc->usb2_phy);
> -	usb_phy_shutdown(dwc->usb3_phy);
> -	phy_exit(dwc->usb2_generic_phy);
>  	phy_exit(dwc->usb3_generic_phy);
> -
> +err_exit_usb2_phy:
> +	phy_exit(dwc->usb2_generic_phy);
> +err_shutdown_usb3_phy:
> +	usb_phy_shutdown(dwc->usb3_phy);
> +	usb_phy_shutdown(dwc->usb2_phy);
>  err0a:
>  	dwc3_ulpi_exit(dwc);
>  
> -- 
> 2.39.2
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@...opsys.com>

Thanks,
Thinh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ