From: sashiko-bot@kernel.org
To: "Wanhui Fu" <fuwh1120@163.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 3/3] usb: gadget: fsl_udc: Register IRQ after allocating controller resources
Date: Tue, 01 Dec 2026 13:23:13 +0000 [thread overview]
Message-ID: <sashiko-outbox-243388@kernel.org> (raw)
In-Reply-To: <20261201131501.3418743-4-fuwh1120@163.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] usb: gadget: fsl-udc: uninitialized max_pipes in reset_queues()
[1]
--
commit 1498c3fab6f8a6458d770db0f7756b50a41cfe18
Author: Wanhui Fu <fuwh1120@163.com>
usb: gadget: fsl_udc: Register IRQ after allocating controller resources
This commit moves request_irq() in fsl_udc_probe() to run after
struct_udc_setup() and dma_pool_create() so that resources are allocated
before the interrupt handler is registered and cleaned up in reverse
order on failure.
> diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
> index bf30c64e4983e..398a4c19e86de 100644
> --- a/drivers/usb/gadget/udc/fsl_udc_core.c
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -2451,22 +2451,14 @@ static int fsl_udc_probe(struct platform_device *pdev)
> }
> udc_controller->irq = ret;
>
> - ret = request_irq(udc_controller->irq, fsl_udc_irq, IRQF_SHARED,
> - driver_name, udc_controller);
> - if (ret != 0) {
> - dev_err(&pdev->dev, "cannot request irq %d err %d\n",
> - udc_controller->irq, ret);
> - goto err_exit;
> - }
> -
> /* Initialize the udc structure including QH member and other member */
> if (struct_udc_setup(udc_controller, pdev)) {
> dev_err(&pdev->dev, "Can't initialize udc data structure\n");
> ret = -ENOMEM;
> - goto err_free_irq;
> + goto err_exit;
> }
[Severity: High]
This problem wasn't introduced by this patch, but fsl_udc_probe() only
initializes udc_controller->max_ep and leaves udc_controller->max_pipes
as 0 [1]. When a USB bus reset or disconnect calls reset_queues(),
does the loop over udc->max_pipes exit without calling
udc_reset_ep_queue()?
drivers/usb/gadget/udc/fsl_udc_core.c:reset_queues() {
for (pipe = 0; pipe < udc->max_pipes; pipe++)
udc_reset_ep_queue(udc, pipe);
}
Because no endpoint queues are flushed, pending USB requests are leaked
without completion callbacks and later re-enumerations run against
unreset endpoint state.
[1] https://sashiko.dev/#/bug/linux-83376ec3-eefe-439e-9525-12d77a7d272b
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201131501.3418743-1-fuwh1120@163.com?part=3
next prev parent reply other threads:[~2026-12-01 13:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 13:14 [PATCH 0/3] usb: gadget: fsl_udc: Fix resource management Wanhui Fu
2026-12-01 13:14 ` [PATCH 1/3] usb: gadget: fsl_udc: Fix incorrect freeing of DMA queue heads Wanhui Fu
2026-12-01 13:15 ` [PATCH 2/3] usb: gadget: fsl_udc: Fix gadget lifetime and probe resource leaks Wanhui Fu
2026-12-01 13:15 ` [PATCH 3/3] usb: gadget: fsl_udc: Register IRQ after allocating controller resources Wanhui Fu
2026-12-01 13:23 ` sashiko-bot [this message]
2026-12-01 13:26 ` [PATCH 0/3] usb: gadget: fsl_udc: Fix resource management sashiko-bot
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=sashiko-outbox-243388@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fuwh1120@163.com \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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