linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan+linaro@kernel.org>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan+linaro@kernel.org>
Subject: [PATCH 06/11] USB: dwc3: clean up probe error labels
Date: Tue,  4 Apr 2023 09:25:19 +0200	[thread overview]
Message-ID: <20230404072524.19014-7-johan+linaro@kernel.org> (raw)
In-Reply-To: <20230404072524.19014-1-johan+linaro@kernel.org>

Use descriptive names consistently for the probe error labels.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/usb/dwc3/core.c | 45 ++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index d837ab511686..de84e057d28b 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1705,7 +1705,7 @@ static int dwc3_probe(struct platform_device *pdev)
 	dwc->reset = devm_reset_control_array_get_optional_shared(dev);
 	if (IS_ERR(dwc->reset)) {
 		ret = PTR_ERR(dwc->reset);
-		goto put_usb_psy;
+		goto err_put_psy;
 	}
 
 	if (dev->of_node) {
@@ -1719,7 +1719,7 @@ static int dwc3_probe(struct platform_device *pdev)
 		if (IS_ERR(dwc->bus_clk)) {
 			ret = dev_err_probe(dev, PTR_ERR(dwc->bus_clk),
 					    "could not get bus clock\n");
-			goto put_usb_psy;
+			goto err_put_psy;
 		}
 
 		if (dwc->bus_clk == NULL) {
@@ -1727,7 +1727,7 @@ static int dwc3_probe(struct platform_device *pdev)
 			if (IS_ERR(dwc->bus_clk)) {
 				ret = dev_err_probe(dev, PTR_ERR(dwc->bus_clk),
 						    "could not get bus clock\n");
-				goto put_usb_psy;
+				goto err_put_psy;
 			}
 		}
 
@@ -1735,7 +1735,7 @@ static int dwc3_probe(struct platform_device *pdev)
 		if (IS_ERR(dwc->ref_clk)) {
 			ret = dev_err_probe(dev, PTR_ERR(dwc->ref_clk),
 					    "could not get ref clock\n");
-			goto put_usb_psy;
+			goto err_put_psy;
 		}
 
 		if (dwc->ref_clk == NULL) {
@@ -1743,7 +1743,7 @@ static int dwc3_probe(struct platform_device *pdev)
 			if (IS_ERR(dwc->ref_clk)) {
 				ret = dev_err_probe(dev, PTR_ERR(dwc->ref_clk),
 						    "could not get ref clock\n");
-				goto put_usb_psy;
+				goto err_put_psy;
 			}
 		}
 
@@ -1751,7 +1751,7 @@ static int dwc3_probe(struct platform_device *pdev)
 		if (IS_ERR(dwc->susp_clk)) {
 			ret = dev_err_probe(dev, PTR_ERR(dwc->susp_clk),
 					    "could not get suspend clock\n");
-			goto put_usb_psy;
+			goto err_put_psy;
 		}
 
 		if (dwc->susp_clk == NULL) {
@@ -1759,23 +1759,23 @@ static int dwc3_probe(struct platform_device *pdev)
 			if (IS_ERR(dwc->susp_clk)) {
 				ret = dev_err_probe(dev, PTR_ERR(dwc->susp_clk),
 						    "could not get suspend clock\n");
-				goto put_usb_psy;
+				goto err_put_psy;
 			}
 		}
 	}
 
 	ret = reset_control_deassert(dwc->reset);
 	if (ret)
-		goto put_usb_psy;
+		goto err_put_psy;
 
 	ret = dwc3_clk_enable(dwc);
 	if (ret)
-		goto assert_reset;
+		goto err_assert_reset;
 
 	if (!dwc3_core_is_valid(dwc)) {
 		dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
 		ret = -ENODEV;
-		goto disable_clks;
+		goto err_disable_clks;
 	}
 
 	platform_set_drvdata(pdev, dwc);
@@ -1785,7 +1785,7 @@ static int dwc3_probe(struct platform_device *pdev)
 	    DWC3_GHWPARAMS0_AWIDTH(dwc->hwparams.hwparams0) == 64) {
 		ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));
 		if (ret)
-			goto disable_clks;
+			goto err_disable_clks;
 	}
 
 	spin_lock_init(&dwc->lock);
@@ -1803,23 +1803,23 @@ static int dwc3_probe(struct platform_device *pdev)
 	if (ret) {
 		dev_err(dwc->dev, "failed to allocate event buffers\n");
 		ret = -ENOMEM;
-		goto err2;
+		goto err_allow_rpm;
 	}
 
 	dwc->edev = dwc3_get_extcon(dwc);
 	if (IS_ERR(dwc->edev)) {
 		ret = dev_err_probe(dwc->dev, PTR_ERR(dwc->edev), "failed to get extcon\n");
-		goto err3;
+		goto err_free_event_buffers;
 	}
 
 	ret = dwc3_get_dr_mode(dwc);
 	if (ret)
-		goto err3;
+		goto err_free_event_buffers;
 
 	ret = dwc3_core_init(dwc);
 	if (ret) {
 		dev_err_probe(dev, ret, "failed to initialize core\n");
-		goto err3;
+		goto err_free_event_buffers;
 	}
 
 	dwc3_check_params(dwc);
@@ -1827,13 +1827,13 @@ static int dwc3_probe(struct platform_device *pdev)
 
 	ret = dwc3_core_init_mode(dwc);
 	if (ret)
-		goto err5;
+		goto err_exit_debugfs;
 
 	pm_runtime_put(dev);
 
 	return 0;
 
-err5:
+err_exit_debugfs:
 	dwc3_debugfs_exit(dwc);
 	dwc3_event_buffers_cleanup(dwc);
 
@@ -1848,20 +1848,19 @@ static int dwc3_probe(struct platform_device *pdev)
 	phy_exit(dwc->usb3_generic_phy);
 
 	dwc3_ulpi_exit(dwc);
-err3:
+err_free_event_buffers:
 	dwc3_free_event_buffers(dwc);
-
-err2:
+err_allow_rpm:
 	pm_runtime_allow(dev);
 	pm_runtime_disable(dev);
 	pm_runtime_dont_use_autosuspend(dev);
 	pm_runtime_set_suspended(dev);
 	pm_runtime_put_noidle(dev);
-disable_clks:
+err_disable_clks:
 	dwc3_clk_disable(dwc);
-assert_reset:
+err_assert_reset:
 	reset_control_assert(dwc->reset);
-put_usb_psy:
+err_put_psy:
 	if (dwc->usb_psy)
 		power_supply_put(dwc->usb_psy);
 
-- 
2.39.2


  parent reply	other threads:[~2023-04-04  7:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04  7:25 [PATCH 00/11] USB: dwc3: error handling fixes and cleanups Johan Hovold
2023-04-04  7:25 ` [PATCH 01/11] USB: dwc3: fix runtime pm imbalance on probe errors Johan Hovold
2023-04-11  1:22   ` Thinh Nguyen
2023-04-04  7:25 ` [PATCH 02/11] USB: dwc3: fix runtime pm imbalance on unbind Johan Hovold
2023-04-11  1:22   ` Thinh Nguyen
2023-04-04  7:25 ` [PATCH 03/11] USB: dwc3: disable autosuspend " Johan Hovold
2023-04-11  1:17   ` Thinh Nguyen
2023-04-04  7:25 ` [PATCH 04/11] USB: dwc3: gadget: drop dead hibernation code Johan Hovold
2023-04-07  1:59   ` Thinh Nguyen
2023-04-04  7:25 ` [PATCH 05/11] USB: dwc3: " Johan Hovold
2023-04-07  1:58   ` Thinh Nguyen
2023-04-04  7:25 ` Johan Hovold [this message]
2023-04-07  0:49   ` [PATCH 06/11] USB: dwc3: clean up probe error labels Thinh Nguyen
2023-04-04  7:25 ` [PATCH 07/11] USB: dwc3: clean up phy init error handling Johan Hovold
2023-04-07  1:00   ` Thinh Nguyen
2023-04-04  7:25 ` [PATCH 08/11] USB: dwc3: clean up core " Johan Hovold
2023-04-07  0:56   ` Thinh Nguyen
2023-04-04  7:25 ` [PATCH 09/11] USB: dwc3: refactor phy handling Johan Hovold
2023-04-07  1:31   ` Thinh Nguyen
2023-04-04  7:25 ` [PATCH 10/11] USB: dwc3: refactor clock lookups Johan Hovold
2023-04-07  0:47   ` Thinh Nguyen
2023-04-04  7:25 ` [PATCH 11/11] USB: dwc3: clean up probe declarations Johan Hovold
2023-04-07  0:46   ` Thinh Nguyen
2023-04-07  2:09 ` [PATCH 00/11] USB: dwc3: error handling fixes and cleanups Thinh Nguyen

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=20230404072524.19014-7-johan+linaro@kernel.org \
    --to=johan+linaro@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.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).