Re: [PATCH] ASoC: fsl_asrc_dma: fix error handling for DMA channel retrieval
From: Chancel Liu
Date: Fri Nov 06 2026 - 00:56:48 EST
On 10/28/2026 10:59 AM, shengjiu.wang@xxxxxxxxxxx wrote:
> From: Shengjiu Wang <shengjiu.wang@xxxxxxx>
>
> The original check used `if (!tmp_chan)`, which only catches NULL pointers.
> However `asrc->get_dma_channel()` returns an error pointer. The NULL check
> will always succeed, so replace it with `IS_ERR(tmp_chan)` to correctly
> detect errors.
>
> Fixes: b4136c0d69ea ("ASoC: fsl_asrc: check the second front-end DMA channel")
> Signed-off-by: Shengjiu Wang <shengjiu.wang@xxxxxxx>
Reviewed-by: Chancel Liu <chancel.liu@xxxxxxxxx>
Regards,
Chancel Liu
> ---
> sound/soc/fsl/fsl_asrc_dma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
> index b417de6abebe..b39d3d76d26a 100644
> --- a/sound/soc/fsl/fsl_asrc_dma.c
> +++ b/sound/soc/fsl/fsl_asrc_dma.c
> @@ -251,7 +251,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,
>
> /* Get DMA request of Front-End */
> tmp_chan = asrc->get_dma_channel(pair, dir);
> - if (!tmp_chan) {
> + if (IS_ERR(tmp_chan)) {
> dma_release_channel(pair->dma_chan[!dir]);
> pair->dma_chan[!dir] = NULL;
> return -EINVAL;