ASoC: qcom: Fix error code in lpass_platform_copy()
[sfrench/cifs-2.6.git] / sound / soc / qcom / lpass-platform.c
index b3af971286bb37a51704af8b6d8c3cbda204a4f4..6f58f246476e727d04963a5d793334894e140ad0 100644 (file)
@@ -986,7 +986,8 @@ static irqreturn_t lpass_dma_interrupt_handler(
                                "error writing to irqclear reg: %d\n", rv);
                        return IRQ_NONE;
                }
-               dev_warn(soc_runtime->dev, "xrun warning\n");
+               dev_warn_ratelimited(soc_runtime->dev, "xrun warning\n");
+
                snd_pcm_stop_xrun(substream);
                ret = IRQ_HANDLED;
        }
@@ -1228,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;