All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: vkoul@kernel.org, dmaengine@vger.kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH 08/26] dmaengine: owl-dma: Remove redundant dev_err()/dev_err_probe()
Date: Thu, 09 Jul 2026 14:16:07 +0000	[thread overview]
Message-ID: <20260709141608.21C001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709135846.97972-9-panchuang@vivo.com>

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

Pre-existing issues:
- [High] The driver directly passes the signed return value of `platform_get_irq()` to `devm_request_irq()` without checking for errors, causing negative error codes like `-EPROBE_DEFER` to be cast to large unsigned integers and replaced by `-EINVAL`, permanently breaking probe deferral.
- [High] The IRQ handler is registered before critical data structures (`od->pchans`) are allocated and before the hardware clock is enabled (`clk_prepare_enable`), risking a system crash or NULL pointer dereference.
- [High] The return value of `clk_prepare_enable()` is not checked. If the clock fails to enable, the driver silently registers the DMA controller, leading to a system crash when clients later attempt to use it.
- [High] During probe error paths, the clock is manually disabled while the devres-managed IRQ remains registered and active, creating a race condition that can cause a system crash.
--

--- Patch [8]: [PATCH 08/26] dmaengine: owl-dma: Remove redundant dev_err()/dev_err_probe() ---
commit 8f8dd83b44c39b0ec6f44933f79e28cff3053a61
Author: Pan Chuang <panchuang@vivo.com>

dmaengine: owl-dma: Remove redundant dev_err()/dev_err_probe()

This commit removes driver-specific error logging around devm_request_irq()
since the core now automatically logs detailed error messages on failure.

> diff --git a/drivers/dma/owl-dma.c b/drivers/dma/owl-dma.c
> index 7c80572fc71d1..71d0b15968c6d 100644
> --- a/drivers/dma/owl-dma.c
> +++ b/drivers/dma/owl-dma.c
> @@ -1163,10 +1163,8 @@ static int owl_dma_probe(struct platform_device *pdev)
>  	od->irq = platform_get_irq(pdev, 0);
>  	ret = devm_request_irq(&pdev->dev, od->irq, owl_dma_interrupt, 0,
>  			       dev_name(&pdev->dev), od);

[Severity: High]
This is a pre-existing issue, but is it safe to pass the unchecked return
value of platform_get_irq() directly to devm_request_irq()?

If platform_get_irq() returns a negative error code like -EPROBE_DEFER,
it gets cast to a large unsigned integer. This causes devm_request_irq()
to fail with -EINVAL, which permanently breaks probe deferral.

[Severity: High]
This is a pre-existing issue, but does requesting the IRQ here risk a crash?

The IRQ is unmasked before od->pchans is allocated and before the hardware
clock is enabled. If a spurious interrupt fires immediately,
owl_dma_interrupt() will attempt to access hardware registers and dereference
the uninitialized od->pchans pointer:

owl_dma_interrupt() {
	pending = dma_readl(od, OWL_DMA_IRQ_PD0);
	...
	for_each_set_bit(i, &pending, od->nr_pchans) {
		pchan = &od->pchans[i];
		pchan_update(pchan, OWL_DMAX_INT_STATUS, 0xff, false);
	}
}

> -	if (ret) {
> -		dev_err(&pdev->dev, "unable to request IRQ\n");
> +	if (ret)
>  		return ret;
> -	}
>  
>  	/* Init physical channel */
>  	od->pchans = devm_kcalloc(&pdev->dev, od->nr_pchans,

[Severity: High]
This is a pre-existing issue, but further down in owl_dma_probe(), is it
intended that the return value of clk_prepare_enable() is unchecked?

owl_dma_probe() {
	...
	clk_prepare_enable(od->clk);

	ret = dma_async_device_register(&od->dma);
	...
}

If the clock fails to enable, the driver silently registers the DMA
controller, which can lead to a system crash when clients later attempt
to use it and access unclocked hardware.

[Severity: High]
This is a pre-existing issue, but does the error path in owl_dma_probe()
leave a window for a crash?

owl_dma_probe() {
	...
err_pool_free:
	clk_disable_unprepare(od->clk);
	dma_pool_destroy(od->lli_pool);

	return ret;
}

The clock is manually disabled here, but the devres-managed IRQ remains
registered and active until the probe function returns and triggers devres
cleanup. If an interrupt fires during this window, the handler will access
unclocked hardware registers.

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

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

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

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=20260709141608.21C001F000E9@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.