ASoC: qcom: Fix error code in lpass_platform_copy()
The copy_to/from_user() functions return the number of bytes remaining
to be copied. This function needs to return negative error codes
because snd_soc_pcm_component_copy_user() treats positive returns as
success in soc_component_ret().
Fixes: 7d7209557b
("ASoC: qcom: Add support for codec dma driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220301081104.GB17375@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
de2c6f9881
Коммит
d5dd781bcc
|
@ -1229,15 +1229,19 @@ static int lpass_platform_copy(struct snd_soc_component *component,
|
|||
channel * (rt->dma_bytes / rt->channels));
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
if (is_cdc_dma_port(dai_id))
|
||||
if (is_cdc_dma_port(dai_id)) {
|
||||
ret = copy_from_user_toio(dma_buf, buf, bytes);
|
||||
else
|
||||
ret = copy_from_user((void __force *)dma_buf, buf, bytes);
|
||||
} else {
|
||||
if (copy_from_user((void __force *)dma_buf, buf, bytes))
|
||||
ret = -EFAULT;
|
||||
}
|
||||
} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
|
||||
if (is_cdc_dma_port(dai_id))
|
||||
if (is_cdc_dma_port(dai_id)) {
|
||||
ret = copy_to_user_fromio(buf, dma_buf, bytes);
|
||||
else
|
||||
ret = copy_to_user(buf, (void __force *)dma_buf, bytes);
|
||||
} else {
|
||||
if (copy_to_user(buf, (void __force *)dma_buf, bytes))
|
||||
ret = -EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Загрузка…
Ссылка в новой задаче