[PATCH v1 1/1] ASoC: sprd: Shadow errors from dma_request_chan()

From: Andy Shevchenko

Date: Thu Sep 24 2026 - 12:57:04 EST


For some reason the SPDR PCM support code requests DMA resources
in the IOCTL. This might lead to the Linux error codes, such as
EPROBE_DEFER, to be leaked to the user space. Prevent that from
happening by shadowing errors from dma_request_chan() as it was
done previously (see Fixes tag).

Fixes: 08d77e31df21 ("ASoC: sprd: Replace dma_request_slave_channel() by dma_request_chan()")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Closes: https://lore.kernel.org/r/20260918115229.CC8AC1F000FF@xxxxxxxxxxxxxxx
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
sound/soc/sprd/sprd-pcm-compress.c | 2 +-
sound/soc/sprd/sprd-pcm-dma.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sprd/sprd-pcm-compress.c b/sound/soc/sprd/sprd-pcm-compress.c
index 0b110b72482c..d18c9a4e5a77 100644
--- a/sound/soc/sprd/sprd-pcm-compress.c
+++ b/sound/soc/sprd/sprd-pcm-compress.c
@@ -157,7 +157,7 @@ static int sprd_platform_compr_dma_config(struct snd_soc_component *component,
chan = dma_request_chan(dev, dma_params->chan_name[channel]);
if (IS_ERR(chan)) {
dev_err(dev, "failed to request dma channel\n");
- return PTR_ERR(chan);
+ return -ENODEV;
}
dma->chan = chan;

diff --git a/sound/soc/sprd/sprd-pcm-dma.c b/sound/soc/sprd/sprd-pcm-dma.c
index bc4d24e5a25d..fadaafbd807c 100644
--- a/sound/soc/sprd/sprd-pcm-dma.c
+++ b/sound/soc/sprd/sprd-pcm-dma.c
@@ -171,7 +171,7 @@ static int sprd_pcm_request_dma_channel(struct snd_soc_component *component,
dev_err(dev, "failed to request dma channel:%s\n",
dma_params->chan_name[i]);
sprd_pcm_release_dma_channel(substream);
- return PTR_ERR(chan);
+ return -ENODEV;
}
data->chan = chan;
}
--
2.50.1