From: sashiko-bot@kernel.org
To: Sheetal <sheetal@nvidia.com>
Cc: Frank.Li@kernel.org, vkoul@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v6] dmaengine: tegra210-adma: Add error logging on failure paths
Date: Wed, 13 May 2026 20:14:03 +0000 [thread overview]
Message-ID: <20260513201408.36A02C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260512092508.1406119-1-sheetal@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Race condition on probe error paths due to async pm_runtime_put() followed by pm_runtime_disable(), leaving hardware powered on.
--
commit 64b163be27d8e21c8b03c51eb8cec223bd8a75f4
Author: Sheetal <sheetal@nvidia.com>
dmaengine: tegra210-adma: Add error logging on failure paths
This commit adds error logging across failure paths to improve
debuggability of DMA errors during runtime and probe. It also cleans up the
probe path using devres managed helpers like devm_pm_runtime_enable() and
dmaenginem_async_device_register(), removing manual error unwind labels.
> diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
> index 14e0c408ed1e6..6987bf6ec6487 100644
> --- a/drivers/dma/tegra210-adma.c
> +++ b/drivers/dma/tegra210-adma.c
[ ... ]
> @@ -1127,26 +1160,33 @@ static int tegra_adma_probe(struct platform_device *pdev)
> cdata->global_ch_config_base + (4 * i);
> }
>
> - tdc->irq = of_irq_get(pdev->dev.of_node, i);
> - if (tdc->irq <= 0) {
> - ret = tdc->irq ?: -ENXIO;
> - goto irq_dispose;
> - }
> + ret = of_irq_get(pdev->dev.of_node, i);
> + if (ret <= 0)
> + return dev_err_probe(&pdev->dev, ret ?: -ENXIO,
> + "failed to get IRQ for channel %d\n", i);
> + tdc->irq = ret;
>
> vchan_init(&tdc->vc, &tdma->dma_dev);
> tdc->vc.desc_free = tegra_adma_desc_free;
> tdc->tdma = tdma;
> }
>
> - pm_runtime_enable(&pdev->dev);
> + ret = devm_pm_runtime_enable(&pdev->dev);
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret,
> + "failed to enable runtime PM\n");
> +
> + ACQUIRE(pm_runtime_active_try_enabled, pm)(&pdev->dev);
>
> - ret = pm_runtime_resume_and_get(&pdev->dev);
> + ret = ACQUIRE_ERR(pm_runtime_active_try_enabled, &pm);
> if (ret < 0)
> - goto rpm_disable;
> + return dev_err_probe(&pdev->dev, ret,
> + "runtime PM resume failed\n");
>
> ret = tegra_adma_init(tdma);
> if (ret)
> - goto rpm_put;
> + return dev_err_probe(&pdev->dev, ret,
> + "failed to initialize ADMA\n");
Does using a scoped guard here introduce a race condition on error paths?
The scoped guard drops its reference using an asynchronous pm_runtime_put()
when it goes out of scope on return. If the probe fails after this point,
the guard drops the reference asynchronously, and then the devres framework
executes pm_runtime_disable() to tear down the environment.
Calling pm_runtime_disable() immediately after an async pm_runtime_put() can
intercept and cancel the pending async suspend work, which leaves the
hardware powered on in an incorrect power state. The original code avoided
this by explicitly calling pm_runtime_put_sync() before disabling runtime PM.
Also, does this change the resource teardown order?
The scoped guard drops the PM reference immediately when the function
returns, which happens before devres executes
dmaenginem_async_device_unregister(). This causes the DMA engine to be
unregistered after the power reference has already been dropped,
breaking the LIFO teardown order from the original code where the PM
put happened after DMA engine unregistration.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260512092508.1406119-1-sheetal@nvidia.com?part=1
prev parent reply other threads:[~2026-05-13 20:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 9:25 [PATCH v6] dmaengine: tegra210-adma: Add error logging on failure paths Sheetal
2026-05-12 20:07 ` Frank Li
2026-05-13 20:14 ` 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=20260513201408.36A02C19425@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sheetal@nvidia.com \
--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