From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: dmaengine@vger.kernel.org, Frank.Li@kernel.org, vkoul@kernel.org
Subject: Re: [PATCH 15/26] dmaengine: sh-usb-dmac: Remove redundant dev_err()/dev_err_probe()
Date: Thu, 09 Jul 2026 14:27:21 +0000 [thread overview]
Message-ID: <20260709142721.A7B5B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709135846.97972-16-panchuang@vivo.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
Pre-existing issues:
- [High] The driver unconditionally replaces the error code from `platform_get_irq_byname` with `-ENODEV`, breaking probe deferral.
- [High] Shared interrupt is requested before `vchan_init` initializes the channel's spinlock and lists.
- [High] Missing IRQ cleanup in the probe error path leaves shared interrupts registered while device clocks are disabled.
- [High] The driver fails to cancel the `vchan` tasklets during channel teardown and device removal, which can lead to a Use-After-Free if a tasklet executes after the device memory is freed.
- [High] If `pm_runtime_get_sync()` fails in `usb_dmac_alloc_chan_resources()`, the newly allocated DMA descriptors and the PM runtime usage counter are permanently leaked.
--
--- Patch [15]: [PATCH 15/26] dmaengine: sh-usb-dmac: Remove redundant dev_err()/dev_err_probe() ---
commit 26b5ad26e29c18063b36a1a20ac48c474a74b7b1
Author: Pan Chuang <panchuang@vivo.com>
dmaengine: sh-usb-dmac: Remove redundant dev_err()/dev_err_probe()
The devm_request_irq() now automatically logs detailed error messages on
failure. This eliminates the need for driver-specific dev_err() and
dev_err_probe() calls that previously printed generic messages.
> diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
> index 16509be0d3608..17b385d857930 100644
> --- a/drivers/dma/sh/usb-dmac.c
> +++ b/drivers/dma/sh/usb-dmac.c
> @@ -726,11 +726,8 @@ static int usb_dmac_chan_probe(struct usb_dmac *dmac,
>
> ret = devm_request_irq(dmac->dev, uchan->irq, usb_dmac_isr_channel,
> IRQF_SHARED, irqname, uchan);
[Severity: High]
This is a pre-existing issue, but is the shared interrupt requested too
early?
devm_request_irq() is called with IRQF_SHARED before vchan_init()
initializes the channel's spinlock and lists. If another device sharing
the IRQ line fires an interrupt immediately, the registered ISR
usb_dmac_isr_channel() will execute and unconditionally acquire the
uninitialized chan->vc.lock:
drivers/dma/sh/usb-dmac.c:usb_dmac_isr_channel() {
...
spin_lock(&chan->vc.lock);
...
}
Could this lead to a lockdep splat or kernel panic on platforms where this
IRQ line is shared with another active device?
> - if (ret) {
> - dev_err(dmac->dev, "failed to request IRQ %u (%d)\n",
> - uchan->irq, ret);
> + if (ret)
> return ret;
> - }
>
> uchan->vc.desc_free = usb_dmac_virt_desc_free;
> vchan_init(&uchan->vc, &dmac->engine);
[Severity: High]
This is a pre-existing issue, but does the unconditional return of
-ENODEV earlier in usb_dmac_chan_probe() break probe deferral?
drivers/dma/sh/usb-dmac.c:usb_dmac_chan_probe() {
...
uchan->irq = platform_get_irq_byname(pdev, pdev_irqname);
if (uchan->irq < 0)
return -ENODEV;
...
}
If the interrupt controller is probed after the DMA controller,
platform_get_irq_byname() would return -EPROBE_DEFER, which gets
incorrectly replaced with -ENODEV. Will this cause the driver to
permanently fail to probe?
[Severity: High]
This is a pre-existing issue, but does the probe error path leave shared
interrupts active while device clocks are disabled?
drivers/dma/sh/usb-dmac.c:usb_dmac_probe() {
...
error:
of_dma_controller_free(pdev->dev.of_node);
error_pm:
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
return ret;
}
If dma_async_device_register() fails, the error path disables PM runtime.
However, the shared IRQs for successfully probed channels remain active
until devres cleans them up after the function returns. If a shared
interrupt fires in this window, could the ISR access device registers
with stopped clocks and cause an imprecise external abort?
[Severity: High]
This is a pre-existing issue, but does the channel teardown logic fail to
cancel the vchan tasklets?
drivers/dma/sh/usb-dmac.c:usb_dmac_chan_remove() {
usb_dmac_chan_halt(uchan);
devm_free_irq(dmac->dev, uchan->irq, uchan);
}
If the driver is unbound or fails during probe while a vchan tasklet is
scheduled, devres will free the DMA controller memory containing the
tasklet structure. If the tasklet subsequently executes, will it access
freed memory? Should tasklet_kill(&uchan->vc.task) be called here?
[Severity: High]
This is a pre-existing issue, but does this leak resources if
pm_runtime_get_sync() fails?
drivers/dma/sh/usb-dmac.c:usb_dmac_alloc_chan_resources() {
...
return pm_runtime_get_sync(chan->device->dev);
}
If it returns a negative error, it leaves the PM runtime usage counter
incremented and the previously allocated DMA descriptors are not freed.
The dmaengine core abandons the channel without calling
device_free_chan_resources(), which appears to result in a permanent leak
preventing the device from entering runtime suspend.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709135846.97972-1-panchuang@vivo.com?part=15
next prev parent reply other threads:[~2026-07-09 14:27 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 13:58 [PATCH 00/26] dmaengine: Remove redundant error messages on IRQ request failure Pan Chuang
2026-07-09 13:58 ` Pan Chuang
2026-07-09 13:58 ` [PATCH 01/26] dmaengine: fsl-edma-main: Remove redundant dev_err()/dev_err_probe() Pan Chuang
2026-07-09 14:12 ` sashiko-bot
2026-07-09 14:33 ` Frank Li
2026-07-09 13:58 ` [PATCH 02/26] dmaengine: fsl-qdma: " Pan Chuang
2026-07-09 14:08 ` sashiko-bot
2026-07-09 14:34 ` Frank Li
2026-07-09 13:58 ` [PATCH 03/26] dmaengine: loongson-loongson1-apb-dma: " Pan Chuang
2026-07-09 14:11 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 04/26] dmaengine: mediatek-mtk-cqdma: " Pan Chuang
2026-07-09 14:10 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 05/26] dmaengine: mediatek-mtk-hsdma: " Pan Chuang
2026-07-09 14:10 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 06/26] dmaengine: mmp_pdma: " Pan Chuang
2026-07-09 14:08 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 07/26] dmaengine: moxart-dma: " Pan Chuang
2026-07-09 14:16 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 08/26] dmaengine: owl-dma: " Pan Chuang
2026-07-09 14:16 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 09/26] dmaengine: pxa_dma: " Pan Chuang
2026-07-09 14:20 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 10/26] dmaengine: qcom-gpi: " Pan Chuang
2026-07-09 14:19 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 11/26] dmaengine: sf-pdma-sf-pdma: " Pan Chuang
2026-07-09 13:58 ` Pan Chuang
2026-07-09 14:18 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 12/26] dmaengine: sh-rcar-dmac: " Pan Chuang
2026-07-09 14:23 ` sashiko-bot
2026-07-09 14:31 ` Geert Uytterhoeven
2026-07-09 13:58 ` [PATCH 13/26] dmaengine: sh-rz-dmac: " Pan Chuang
2026-07-09 14:32 ` Geert Uytterhoeven
2026-07-09 13:58 ` [PATCH 14/26] dmaengine: sh-shdmac: " Pan Chuang
2026-07-09 14:24 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 15/26] dmaengine: sh-usb-dmac: " Pan Chuang
2026-07-09 14:27 ` sashiko-bot [this message]
2026-07-09 14:33 ` Geert Uytterhoeven
2026-07-09 13:58 ` [PATCH 16/26] dmaengine: sprd-dma: " Pan Chuang
2026-07-09 14:27 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 17/26] dmaengine: st_fdma: " Pan Chuang
2026-07-09 14:30 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 18/26] dmaengine: stm32-stm32-dma: " Pan Chuang
2026-07-09 14:30 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 19/26] dmaengine: stm32-stm32-dma3: " Pan Chuang
2026-07-09 14:33 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 20/26] dmaengine: stm32-stm32-mdma: " Pan Chuang
2026-07-09 14:32 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 21/26] dmaengine: sun4i-dma: " Pan Chuang
2026-07-09 14:35 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 22/26] dmaengine: sun6i-dma: " Pan Chuang
2026-07-09 13:58 ` [PATCH 23/26] dmaengine: tegra20-apb-dma: " Pan Chuang
2026-07-09 13:58 ` [PATCH 24/26] dmaengine: ti-edma: " Pan Chuang
2026-07-09 14:38 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 25/26] dmaengine: uniphier-xdmac: " Pan Chuang
2026-07-09 14:41 ` sashiko-bot
2026-07-09 13:58 ` [PATCH 26/26] dmaengine: xgene-dma: " Pan Chuang
2026-07-09 14:39 ` sashiko-bot
2026-07-09 14:26 ` [PATCH 00/26] dmaengine: Remove redundant error messages on IRQ request failure Wolfram Sang
2026-07-09 14:26 ` Wolfram Sang
2026-07-14 12:06 ` Vinod Koul
2026-07-14 12:06 ` Vinod Koul
2026-07-15 6:44 ` [PATCH 00/26] dmaengine: Remove redundant dev_err()/dev_err_probe() calls Pan Chuang
2026-07-15 6:44 ` Pan Chuang
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=20260709142721.A7B5B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=panchuang@vivo.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.