summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sound/soc/qcom/lpass-platform.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 1ce0878665ca..6f58f246476e 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -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;