From: Vladimir Zapolskiy <vz@mleia.com>
To: Johan Hovold <johan@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>,
Alan Stern <stern@rowland.harvard.edu>,
Ma Ke <make24@iscas.ac.cn>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/5] usb: gadget: lpc32xx_udc: clean up probe error labels
Date: Fri, 19 Dec 2025 02:22:39 +0200 [thread overview]
Message-ID: <09fd6c25-a35e-4f9e-a457-92f6506f461f@mleia.com> (raw)
In-Reply-To: <20251218153519.19453-5-johan@kernel.org>
On 12/18/25 17:35, Johan Hovold wrote:
> Error labels should be named after what they do rather than after from
> where they are jumped to.
>
> Rename the probe error labels for consistency and to improve
> readability.
>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/usb/gadget/udc/lpc32xx_udc.c | 21 ++++++++++-----------
> 1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
> index a962d4294fbe..83c7e243dcf9 100644
> --- a/drivers/usb/gadget/udc/lpc32xx_udc.c
> +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
> @@ -3084,7 +3084,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
> if (!udc->udca_v_base) {
> dev_err(udc->dev, "error getting UDCA region\n");
> retval = -ENOMEM;
> - goto i2c_fail;
> + goto err_disable_clk;
> }
> udc->udca_p_base = dma_handle;
> dev_dbg(udc->dev, "DMA buffer(0x%x bytes), P:0x%08x, V:0x%p\n",
> @@ -3097,7 +3097,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
> if (!udc->dd_cache) {
> dev_err(udc->dev, "error getting DD DMA region\n");
> retval = -ENOMEM;
> - goto dma_alloc_fail;
> + goto err_free_dma;
> }
>
> /* Clear USB peripheral and initialize gadget endpoints */
> @@ -3111,14 +3111,14 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
> if (retval < 0) {
> dev_err(udc->dev, "LP request irq %d failed\n",
> udc->udp_irq[IRQ_USB_LP]);
> - goto irq_req_fail;
> + goto err_destroy_pool;
> }
> retval = devm_request_irq(dev, udc->udp_irq[IRQ_USB_HP],
> lpc32xx_usb_hp_irq, 0, "udc_hp", udc);
> if (retval < 0) {
> dev_err(udc->dev, "HP request irq %d failed\n",
> udc->udp_irq[IRQ_USB_HP]);
> - goto irq_req_fail;
> + goto err_destroy_pool;
> }
>
> retval = devm_request_irq(dev, udc->udp_irq[IRQ_USB_DEVDMA],
> @@ -3126,7 +3126,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
> if (retval < 0) {
> dev_err(udc->dev, "DEV request irq %d failed\n",
> udc->udp_irq[IRQ_USB_DEVDMA]);
> - goto irq_req_fail;
> + goto err_destroy_pool;
> }
>
> /* The transceiver interrupt is used for VBUS detection and will
> @@ -3137,7 +3137,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
> if (retval < 0) {
> dev_err(udc->dev, "VBUS request irq %d failed\n",
> udc->udp_irq[IRQ_USB_ATX]);
> - goto irq_req_fail;
> + goto err_destroy_pool;
> }
>
> /* Initialize wait queue */
> @@ -3146,7 +3146,7 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
>
> retval = usb_add_gadget_udc(dev, &udc->gadget);
> if (retval < 0)
> - goto add_gadget_fail;
> + goto err_destroy_pool;
>
> dev_set_drvdata(dev, udc);
> device_init_wakeup(dev, 1);
> @@ -3158,13 +3158,12 @@ static int lpc32xx_udc_probe(struct platform_device *pdev)
> dev_info(udc->dev, "%s version %s\n", driver_name, DRIVER_VERSION);
> return 0;
>
> -add_gadget_fail:
> -irq_req_fail:
> +err_destroy_pool:
> dma_pool_destroy(udc->dd_cache);
> -dma_alloc_fail:
> +err_free_dma:
> dma_free_coherent(&pdev->dev, UDCA_BUFF_SIZE,
> udc->udca_v_base, udc->udca_p_base);
> -i2c_fail:
> +err_disable_clk:
> clk_disable_unprepare(udc->usb_slv_clk);
> err_put_client:
> put_device(&udc->isp1301_i2c_client->dev);
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
--
Best wishes,
Vladimir
next prev parent reply other threads:[~2025-12-19 0:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 15:35 [PATCH v2 0/5] USB: lpc32xx: fix error handling Johan Hovold
2025-12-18 15:35 ` [PATCH v2 1/5] usb: gadget: lpc32xx_udc: fix clock imbalance in error path Johan Hovold
2025-12-19 0:11 ` Vladimir Zapolskiy
2025-12-18 15:35 ` [PATCH v2 2/5] usb: phy: isp1301: fix non-OF device reference imbalance Johan Hovold
2025-12-19 0:15 ` Vladimir Zapolskiy
2025-12-19 6:20 ` Johan Hovold
2025-12-18 15:35 ` [PATCH v2 3/5] usb: ohci-nxp: fix device leak on probe failure Johan Hovold
2025-12-18 15:52 ` Alan Stern
2025-12-19 0:19 ` Vladimir Zapolskiy
2025-12-18 15:35 ` [PATCH v2 4/5] usb: gadget: lpc32xx_udc: clean up probe error labels Johan Hovold
2025-12-19 0:22 ` Vladimir Zapolskiy [this message]
2025-12-18 15:35 ` [PATCH v2 5/5] usb: ohci-nxp: " Johan Hovold
2025-12-19 0:22 ` Vladimir Zapolskiy
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=09fd6c25-a35e-4f9e-a457-92f6506f461f@mleia.com \
--to=vz@mleia.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=make24@iscas.ac.cn \
--cc=piotr.wojtaszczyk@timesys.com \
--cc=stern@rowland.harvard.edu \
/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
all inboxes | Powered by JetHome®