DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiawen Liu" <1298662399@qq.com>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: sprd-dma: handle runtime PM get failure
Date: Tue, 18 Aug 2026 12:51:03 +0000	[thread overview]
Message-ID: <20260818125104.1398E1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <tencent_72CAD47A90A208C873DD65A726C0A15FC107@qq.com>

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

Pre-existing issues:
- [High] IRQ handler is registered before IO memory is mapped and virtual channels are initialized.
--

--- Patch [1]: [PATCH] dmaengine: sprd-dma: handle runtime PM get failure ---
commit 7b4114d448d81c577f92d85ac8c943dc9f9107c9
Author: jiawen <1298662399@qq.com>

dmaengine: sprd-dma: handle runtime PM get failure

Route failed runtime-PM acquisition through its existing cleanup path.

Release and disable runtime PM before continuing with the hardware
teardown, so an unsuccessful pm_runtime_get_sync() does not leave
runtime PM enabled.

> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index 087fea3af2e41..19b32a23c882d 100644
> --- a/drivers/dma/sprd-dma.c
> +++ b/drivers/dma/sprd-dma.c
> @@ -1212,7 +1212,7 @@ static int sprd_dma_probe(struct platform_device *pdev)
>  
>  	ret = pm_runtime_get_sync(&pdev->dev);

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a pre-existing
issue earlier in sprd_dma_probe() where the IRQ handler is registered
before sdev->glb_base is mapped:

    ret = devm_request_irq(&pdev->dev, sdev->irq, dma_irq_handle,
                   0, "sprd_dma", (void *)sdev);
    ...
    sdev->glb_base = devm_platform_ioremap_resource(pdev, 0);

If an interrupt is pending from a previous kernel (e.g. kexec) or a
bootloader, the unmasked interrupt could cause dma_irq_handle() to
execute immediately.

Because the handler attempts to read from glb_base:

    u32 irq_status = readl(sdev->glb_base + SPRD_DMA_GLB_INT_MSK_STS);

could this cause a NULL pointer dereference and subsequent kernel panic
if the hardware asserts an interrupt before initialization completes?

>  	if (ret < 0)
> -		goto err_rpm;
> +		goto err_register;
>  
>  	ret = dma_async_device_register(&sdev->dma_dev);
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_72CAD47A90A208C873DD65A726C0A15FC107@qq.com?part=1

      reply	other threads:[~2026-08-18 12:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 12:41 [PATCH] dmaengine: sprd-dma: handle runtime PM get failure Jiawen Liu
2026-08-18 12:51 ` sashiko-bot [this message]

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=20260818125104.1398E1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=1298662399@qq.com \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --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