Skip to content

Commit

Permalink
ASoC: apple: mca: Improve handling of unavailable DMA channels
Browse files Browse the repository at this point in the history
When we fail to obtain a DMA channel, don't return a blanket -EINVAL,
instead return the original error code if there's one. This makes
deferring work as it should. Also don't print an error message for
-EPROBE_DEFER.

Fixes: 4ec8179 ("ASoC: apple: mca: Postpone requesting of DMA channels")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20230224153302.45365-3-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Martin Povišer authored and Mark Brown committed Feb 24, 2023
1 parent d8b3e39 commit fb1847c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sound/soc/apple/mca.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,10 +950,17 @@ static int mca_pcm_new(struct snd_soc_component *component,
chan = mca_request_dma_channel(cl, i);

if (IS_ERR_OR_NULL(chan)) {
mca_pcm_free(component, rtd->pcm);

if (chan && PTR_ERR(chan) == -EPROBE_DEFER)
return PTR_ERR(chan);

dev_err(component->dev, "unable to obtain DMA channel (stream %d cluster %d): %pe\n",
i, cl->no, chan);
mca_pcm_free(component, rtd->pcm);
return -EINVAL;

if (!chan)
return -EINVAL;
return PTR_ERR(chan);
}

cl->dma_chans[i] = chan;
Expand Down

0 comments on commit fb1847c

Please sign in to comment.