DMA Engine development
 help / color / mirror / Atom feed
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 02/26] dmaengine: fsl-qdma: Remove redundant dev_err()/dev_err_probe()
Date: Thu, 09 Jul 2026 14:08:31 +0000	[thread overview]
Message-ID: <20260709140831.AFC151F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709135846.97972-3-panchuang@vivo.com>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

New issues:
- [Medium] Incomplete Refactoring / Commit Message Mismatch

Pre-existing issues:
- [High] Driver fails to halt the hardware DMA engine on teardown and error paths
- [High] Inverted teardown order: driver destroys internal resources before unregistering the device
- [High] vchan tasklets are not killed on probe failure
--

--- Patch [2]: [PATCH 02/26] dmaengine: fsl-qdma: Remove redundant dev_err()/dev_err_probe() ---
commit a6f00a613e01411f16385ac0c92bca0027dc654d
Author: Pan Chuang <panchuang@vivo.com>

dmaengine: fsl-qdma: Remove redundant dev_err()/dev_err_probe()

This commit removes a redundant error log following a call to
devm_request_irq, as the core already logs failures. It intends to clean up
the error paths in the qDMA driver.

> 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.

[Severity: Medium]
Is the commit message accurate regarding dev_err_probe? Looking at the
patch, no dev_err_probe calls are actually removed.

Also, does this patch miss the second devm_request_irq in the same
function?

drivers/dma/fsl-qdma.c:fsl_qdma_irq_init() {
[ ... ]
        ret = devm_request_irq(&pdev->dev,
                               fsl_qdma->queue_irq[i],
                               fsl_qdma_queue_handler,
                               0,
                               "qDMA queue",
                               fsl_qdma);
        if (ret) {
                dev_err(&pdev->dev,
                        "Can't register qDMA queue IRQ.\n");
                return  ret;
        }
[ ... ]
}

> diff --git a/drivers/dma/fsl-qdma.c b/drivers/dma/fsl-qdma.c
> index df843fad0ece5..7f0d69b99289e 100644
> --- a/drivers/dma/fsl-qdma.c
> +++ b/drivers/dma/fsl-qdma.c
> @@ -818,10 +818,8 @@ fsl_qdma_irq_init(struct platform_device *pdev,
>  	ret = devm_request_irq(&pdev->dev, fsl_qdma->error_irq,
>  			       fsl_qdma_error_handler, 0,
>  			       "qDMA error", fsl_qdma);
> -	if (ret) {
> -		dev_err(&pdev->dev, "Can't register qDMA controller IRQ.\n");
> +	if (ret)
>  		return  ret;
> -	}
>  
>  	for (i = 0; i < fsl_qdma->block_number; i++) {
>  		sprintf(irq_name, "qdma-queue%d", i);

[Severity: High]
This is a pre-existing issue, but does the driver fail to halt the hardware
DMA engine on teardown and error paths?

fsl_qdma_reg_init() explicitly enables the DMA hardware and its interrupts.
If probe() fails later or when the driver is unbound, the driver never 
invokes fsl_qdma_halt() to stop the device:

drivers/dma/fsl-qdma.c:fsl_qdma_remove() {
        fsl_qdma_irq_exit(pdev, fsl_qdma);
        fsl_qdma_cleanup_vchan(&fsl_qdma->dma_dev);
        of_dma_controller_free(np);
        dma_async_device_unregister(&fsl_qdma->dma_dev);
}

Because the DMA buffers are allocated via devres (e.g., dmam_alloc_coherent),
they are freed immediately upon driver removal or probe failure. Can the
unhalted hardware continue to perform DMA operations into this freed memory?

[Severity: High]
This is a pre-existing issue, but does fsl_qdma_remove() have an inverted
teardown order?

drivers/dma/fsl-qdma.c:fsl_qdma_remove() {
        fsl_qdma_irq_exit(pdev, fsl_qdma);
        fsl_qdma_cleanup_vchan(&fsl_qdma->dma_dev);
        of_dma_controller_free(np);
        dma_async_device_unregister(&fsl_qdma->dma_dev);
}

fsl_qdma_cleanup_vchan() is called before dma_async_device_unregister(). This
creates a window where the DMA controller is still visible to clients via the
DMA engine API, but its backend is destroyed.

Furthermore, fsl_qdma_cleanup_vchan() removes channels from the channels
list. Will dma_async_device_unregister() then iterate over an empty list and
fail to deregister the channels from sysfs?

[Severity: High]
This is a pre-existing issue, but are vchan tasklets properly killed on
probe failure?

drivers/dma/fsl-qdma.c:fsl_qdma_probe() {
[ ... ]
        ret = fsl_qdma_irq_init(pdev, fsl_qdma);
        if (ret)
                return ret;

        ret = dma_async_device_register(&fsl_qdma->dma_dev);
        if (ret)
                return dev_err_probe(&pdev->dev, ret,
                                     "Can't register NXP Layerscape qDMA engine.\n");
[ ... ]
}

vchan_init() initializes the vchan tasklets for each channel. If a subsequent
step like fsl_qdma_irq_init() or dma_async_device_register() fails, probe()
returns the error code directly without calling tasklet_kill().

Because the hardware is already enabled, could an interrupt fire and schedule
the tasklet? When devres frees the fsl_qdma->chans array upon probe failure,
would the scheduled tasklet execute against freed memory?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260709135846.97972-1-panchuang@vivo.com?part=2

  reply	other threads:[~2026-07-09 14:08 UTC|newest]

Thread overview: 56+ 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 ` [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 [this message]
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 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
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

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=20260709140831.AFC151F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox