From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
To: Fabrice Gasnier <fabrice.gasnier@foss.st.com>,
Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
"krzysztof.kozlowski+dt@linaro.org"
<krzysztof.kozlowski+dt@linaro.org>,
"alexandre.torgue@foss.st.com" <alexandre.torgue@foss.st.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-stm32@st-md-mailman.stormreply.com"
<linux-stm32@st-md-mailman.stormreply.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"amelie.delaunay@foss.st.com" <amelie.delaunay@foss.st.com>
Subject: Re: [PATCH v2 1/4] usb: dwc2: improve error handling in __dwc2_lowlevel_hw_enable
Date: Tue, 18 Apr 2023 05:05:26 +0000 [thread overview]
Message-ID: <e78f13a1-b035-c3b8-7aff-1eb0cd55e977@synopsys.com> (raw)
In-Reply-To: <20230414084137.1050487-2-fabrice.gasnier@foss.st.com>
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@foss.st.com>
Acked-by: Minas Harutyunyan <hminas@synopsys.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;
> }
>
next prev parent reply other threads:[~2023-04-18 5:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 8:41 [PATCH v2 0/4] usb: dwc2: add optional clock used on stm32mp15 Fabrice Gasnier
2023-04-14 8:41 ` [PATCH v2 1/4] usb: dwc2: improve error handling in __dwc2_lowlevel_hw_enable Fabrice Gasnier
2023-04-18 5:05 ` Minas Harutyunyan [this message]
2023-04-14 8:41 ` [PATCH v2 2/4] dt-bindings: usb: dwc2: add utmi optional clock Fabrice Gasnier
2023-04-14 21:15 ` Krzysztof Kozlowski
2023-04-14 8:41 ` [PATCH v2 3/4] usb: dwc2: platform: add support for " Fabrice Gasnier
2023-04-18 5:06 ` Minas Harutyunyan
2023-04-14 8:41 ` [PATCH v2 4/4] ARM: dts: stm32: add USB OTG UTMI clock on stm32mp151 Fabrice Gasnier
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=e78f13a1-b035-c3b8-7aff-1eb0cd55e977@synopsys.com \
--to=minas.harutyunyan@synopsys.com \
--cc=alexandre.torgue@foss.st.com \
--cc=amelie.delaunay@foss.st.com \
--cc=devicetree@vger.kernel.org \
--cc=fabrice.gasnier@foss.st.com \
--cc=gregkh@linuxfoundation.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-usb@vger.kernel.org \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).