Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Frank.Li@oss.nxp.com
Cc: linux-sound@vger.kernel.org, imx@lists.linux.dev,
	Frank.Li@kernel.org, wsa+renesas@sang-engineering.com
Subject: Re: [PATCH 2/4] ASoC: fsl: asrc: Use dmaengine API instead of chan->device->dev
Date: Fri, 06 Nov 2026 20:29:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-202212@kernel.org> (raw)
In-Reply-To: <20261106-dma_sound_cleanup-v1-2-5eb8a7b81e87@nxp.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] ASoC: fsl_asrc_dma: ERR_PTR dereference in
  fsl_asrc_dma_hw_params() [1]
--

commit 5ed216d0bcbc0b97f113bf28f5e8a475ae506081
Author: Frank Li <Frank.Li@nxp.com>

ASoC: fsl: asrc: Use dmaengine API instead of chan->device->dev

This commit replaces direct accesses to chan->device->dev with
dmaengine_get_dma_device() and dmaengine_get_provider_device() in the
Freescale ASRC DMA driver.

> diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
> index b417de6abebe4..12c3f19a431a8 100644
> --- a/sound/soc/fsl/fsl_asrc_dma.c
> +++ b/sound/soc/fsl/fsl_asrc_dma.c
> @@ -262,7 +262,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,
>  		pair->dma_data.priority = tmp_data->priority;
>  		dma_release_channel(tmp_chan);
>  
> -		of_dma_node = pair->dma_chan[!dir]->device->dev->of_node;
> +		of_dma_node = dmaengine_get_provider_device(pair->dma_chan[!dir])->of_node;
>  		pair->dma_chan[dir] =
>  			__dma_request_channel(&mask, filter, &pair->dma_data,
>  					      of_dma_node);

[Severity: Critical]
This problem wasn't introduced by this patch, but can tmp_chan->private
dereference an error pointer [1] just above this hunk?

asrc->get_dma_channel() returns an ERR_PTR from dma_request_chan() when
front-end DMA channel allocation fails, whereas fsl_asrc_dma_hw_params()
only checks for !tmp_chan before accessing tmp_chan->private:

sound/soc/fsl/fsl_asrc_dma.c:fsl_asrc_dma_hw_params() {
	...
		tmp_chan = asrc->get_dma_channel(pair, dir);
		if (!tmp_chan) {
			dma_release_channel(pair->dma_chan[!dir]);
			pair->dma_chan[!dir] = NULL;
			return -EINVAL;
		}
		tmp_data = tmp_chan->private;
	...
}

Should this check IS_ERR_OR_NULL(tmp_chan) instead?

[1] https://sashiko.dev/#/bug/linux-564b9a37-0988-4e75-909c-eb977f811fd1

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106-dma_sound_cleanup-v1-0-5eb8a7b81e87@nxp.com?part=2

  reply	other threads:[~2026-11-06 20:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 20:13 [PATCH 0/4] ASoC: Use dmaengine API instead of chan->device->dev Frank.Li
2026-11-06 20:13 ` [PATCH 1/4] ASoC: apple: mca: Use dmaengine_get_dma_device() " Frank.Li
2026-11-06 20:13 ` [PATCH 2/4] ASoC: fsl: asrc: Use dmaengine API " Frank.Li
2026-11-06 20:29   ` sashiko-bot [this message]
2026-11-06 20:13 ` [PATCH 3/4] ASoC: renesas: rcar: Use dmaengine_get_dma_device() " Frank.Li
2026-11-09  1:39   ` Kuninori Morimoto
2026-11-06 20:13 ` [PATCH 4/4] ASoC: ti: davinci-mcasp: Use dmaengine_get_provider_device() API Frank.Li
2026-11-09 12:45 ` [PATCH 0/4] ASoC: Use dmaengine API instead of chan->device->dev Mark Brown

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=sashiko-outbox-202212@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=Frank.Li@oss.nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox