Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: joy.zou@oss.nxp.com
Cc: Frank.Li@kernel.org, vkoul@kernel.org, dmaengine@vger.kernel.org,
	imx@lists.linux.dev
Subject: Re: [PATCH v6 3/5] dmaengine: fsl-edma: convert DMAMUX clock handling to bulk clock API
Date: Wed, 01 Jul 2026 09:39:13 +0000	[thread overview]
Message-ID: <20260701093914.0F11B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701-b4-edma-runtime-opt-v6-3-354ff4229c00@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Changing from `devm_clk_get_enabled` to `devm_clk_bulk_get_optional` silently ignores missing DMAMUX clocks, which were previously mandatory and can lead to synchronous bus errors.
--

commit 7885b2482d67d70ba7ccdebb1cd210d1f8dc8ba2
Author: Joy Zou <joy.zou@nxp.com>

dmaengine: fsl-edma: convert DMAMUX clock handling to bulk clock API

Convert the DMAMUX clock management from individual clock operations to the
bulk clock API to simplify the code. Prepare to add edma engine runtime pm
support.

> diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
> --- a/drivers/dma/fsl-edma-main.c
> +++ b/drivers/dma/fsl-edma-main.c
[ ... ]
> @@ -751,23 +750,37 @@ static int fsl_edma_probe(struct platform_device *pdev)
[ ... ]
> -		fsl_edma->muxclk[i] = devm_clk_get_enabled(&pdev->dev, clkname);
> -		if (IS_ERR(fsl_edma->muxclk[i]))
> -			return dev_err_probe(&pdev->dev,
> -					     PTR_ERR(fsl_edma->muxclk[i]),
> -					     "Missing DMAMUX block clock.\n");
> +		ret = devm_clk_bulk_get_optional(&pdev->dev, fsl_edma->drvdata->dmamuxs,
> +						 fsl_edma->muxclk);

[Severity: High]
Does this change to an optional clock fetch risk a synchronous bus error?

Previously, devm_clk_get_enabled() was used, which would fail probe if the
clock was missing. By switching to devm_clk_bulk_get_optional(), a missing
DMAMUX clock in the device tree will be silently ignored.

If the clocks are missing, devm_clk_bulk_get_optional() returns 0 and sets
the clock pointers to NULL. The subsequent clk_bulk_prepare_enable() call
will succeed safely. However, the driver will later unconditionally access the
unclocked DMAMUX registers:

drivers/dma/fsl-edma-common.c:fsl_edma_chan_mux() {
    ...
    if (fsl_chan->edma->drvdata->flags & FSL_EDMA_DRV_CONFIG32)
        mux_configure32(fsl_chan, muxaddr, ch_off, slot, enable);
    else
        mux_configure8(fsl_chan, muxaddr, ch_off, slot, enable);
    ...
}

Could this lead to a kernel panic when accessing the unclocked registers?
Should this use devm_clk_bulk_get() instead so probe correctly fails for
missing mandatory clocks?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260701-b4-edma-runtime-opt-v6-0-354ff4229c00@oss.nxp.com?part=3

  reply	other threads:[~2026-07-01  9:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  9:29 [PATCH v6 0/5] add runtime suspend/resume support joy.zou
2026-07-01  9:29 ` [PATCH v6 1/5] dmaengine: fsl-edma: use devm_clk_get_optional() for channel clock joy.zou
2026-07-01  9:38   ` sashiko-bot
2026-07-01  9:29 ` [PATCH v6 2/5] dmaengine: fsl-edma: use devm_clk_get_optional() for DMA engine clock joy.zou
2026-07-01  9:40   ` sashiko-bot
2026-07-01  9:29 ` [PATCH v6 3/5] dmaengine: fsl-edma: convert DMAMUX clock handling to bulk clock API joy.zou
2026-07-01  9:39   ` sashiko-bot [this message]
2026-07-01  9:29 ` [PATCH v6 4/5] dmaengine: fsl-edma: add runtime suspend/resume support joy.zou
2026-07-01  9:43   ` sashiko-bot
2026-07-01 14:50     ` Frank Li
2026-07-01  9:29 ` [PATCH v6 5/5] dmaengine: fsl-edma: fix use-after-free after dev_pm_domain_detach() joy.zou
2026-07-01  9:44   ` sashiko-bot
2026-07-01 14:47   ` Frank Li

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=20260701093914.0F11B1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=joy.zou@oss.nxp.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