All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: shengjiu.wang@oss.nxp.com
Cc: conor+dt@kernel.org, Frank.Li@kernel.org, imx@lists.linux.dev,
	devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH 3/4] ASoC: fsl_asrc: expose individual DAIs per conversion pair
Date: Mon, 20 Jul 2026 10:33:41 +0000	[thread overview]
Message-ID: <20260720103342.41A751F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260720095450.1618747-4-shengjiu.wang@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The newly registered DAIs (`paira`, `pairb`, `pairc`) share the exact same `dma_params_tx` and `dma_params_rx` structures, causing a data race and potential DMA misconfiguration when multiple streams are configured concurrently.
--

--- Patch [3]: [PATCH 3/4] ASoC: fsl_asrc: expose individual DAIs per conversion pair ---
commit 71178f6edf2667b8ee88b95ef47b739e170cca4b
Author: Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl_asrc: expose individual DAIs per conversion pair

The i.MX ASRC hardware supports three independent conversion pairs
(A, B, C). This commit replaces the single fsl_asrc_dai instance
with an array of three DAI drivers, one per pair, allowing them
to be routed to separate audio paths simultaneously.

> diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
> index 0b28bcfa47fed..f83d6cdc6412d 100644
> --- a/sound/soc/fsl/fsl_asrc.c
> +++ b/sound/soc/fsl/fsl_asrc.c

[ ... ]

> @@ -1404,7 +1453,7 @@ static int fsl_asrc_probe(struct platform_device *pdev)
>  		goto err_pm_get_sync;
>  
>  	ret = devm_snd_soc_register_component(&pdev->dev, &fsl_asrc_component,
> -					      &fsl_asrc_dai, 1);
> +					      fsl_asrc_dai, ARRAY_SIZE(fsl_asrc_dai));

[Severity: High]
Since this registers multiple DAIs to enable concurrent stream access, can this
cause a data race with the shared DMA parameters?

In fsl_asrc_dai_probe(), all three DAIs are assigned pointers to the exact same
shared DMA parameter structures:

	snd_soc_dai_init_dma_data(dai, &asrc->dma_params_tx,
				  &asrc->dma_params_rx);

When multiple streams are configured concurrently, they will race to overwrite
these shared parameters without locking.

For example, in fsl_asrc_dma_hw_params():

	dma_params_fe = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), substream);
	dma_params_fe->addr = asrc->paddr + asrc->get_fifo_addr(!dir, index);
	dma_params_fe->maxburst = dma_params_be->maxburst;

Could this concurrent mutation cause DMA channels to be programmed with incorrect
FIFO addresses or maxburst values, resulting in audio cross-talk or DMA engine
errors?

>  	if (ret) {
>  		dev_err(&pdev->dev, "failed to register ASoC DAI\n");
>  		goto err_pm_get_sync;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260720095450.1618747-1-shengjiu.wang@oss.nxp.com?part=3

  reply	other threads:[~2026-07-20 10:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20  9:54 [PATCH 0/4] ASoC: fsl: expose individual DAIs per ASRC/EASRC conversion pair/context shengjiu.wang
2026-07-20  9:54 ` [PATCH 1/4] dt-bindings: sound: fsl,imx-asrc: update port binding to support multiple pairs shengjiu.wang
2026-07-20 10:03   ` sashiko-bot
2026-07-20 14:28   ` Mark Brown
2026-07-20  9:54 ` [PATCH 2/4] dt-bindings: sound: fsl,easrc: add ports binding for multiple contexts shengjiu.wang
2026-07-20 10:16   ` sashiko-bot
2026-07-20  9:54 ` [PATCH 3/4] ASoC: fsl_asrc: expose individual DAIs per conversion pair shengjiu.wang
2026-07-20 10:33   ` sashiko-bot [this message]
2026-07-20  9:54 ` [PATCH 4/4] ASoC: fsl_easrc: expose individual DAIs per conversion context shengjiu.wang
2026-07-20 10:43   ` sashiko-bot

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=20260720103342.41A751F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shengjiu.wang@oss.nxp.com \
    /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.