summaryrefslogtreecommitdiff
path: root/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2024-10-17 17:33:46 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2024-10-17 17:33:46 +0530
commit321337c9e82f016a0cd64f81573c18b5731ffa8d (patch)
treee9874bb042e851fec1e19bb8dfca694ef885456a /sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
parentcc57cb4ee3b7918b74d30604735d353b9a5fa23b (diff)
Merge remote-tracking branch 'msm8998/lineage-20' into lineage-20
Change-Id: I126075a330f305c85f8fe1b8c9d408f368be95d1
Diffstat (limited to 'sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c')
-rw-r--r--sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
index 5f4225e675ad..bf2620c999b1 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
- * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1004,6 +1004,14 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
goto fail;
}
+ if ((size == 0 || size < prtd->pcm_count) && ((offset + size) < prtd->pcm_count)) {
+ memset(bufptr + offset + size, 0, prtd->pcm_count - size);
+ if (fbytes > prtd->pcm_count)
+ size = xfer = prtd->pcm_count;
+ else
+ size = xfer = fbytes;
+ }
+
if (copy_to_user(buf, bufptr+offset, xfer)) {
pr_err("Failed to copy buf to user\n");
ret = -EFAULT;