Re: [RESEND v13 07/10] ASoC: qcom: Add support for codec dma driver

From: Dan Carpenter
Date: Thu Feb 17 2022 - 08:16:10 EST


Hi Srinivasa,

url: https://github.com/0day-ci/linux/commits/Srinivasa-Rao-Mandadapu/Add-support-for-audio-on-SC7280-based-targets/20220214-230256
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: m68k-randconfig-m031-20220214 (https://download.01.org/0day-ci/archive/20220215/202202151059.hEuYfkLa-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
sound/soc/qcom/lpass-platform.c:1233 lpass_platform_copy() warn: maybe return -EFAULT instead of the bytes remaining?

vim +1233 sound/soc/qcom/lpass-platform.c

e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1210 static int lpass_platform_copy(struct snd_soc_component *component,
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1211 struct snd_pcm_substream *substream, int channel,
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1212 unsigned long pos, void __user *buf, unsigned long bytes)
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1213 {
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1214 struct snd_pcm_runtime *rt = substream->runtime;
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1215 unsigned int dai_id = component->id;
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1216 int ret = 0;
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1217
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1218 void __iomem *dma_buf = rt->dma_area + pos +
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1219 channel * (rt->dma_bytes / rt->channels);
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1220
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1221 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1222 if (is_cdc_dma_port(dai_id))
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1223 ret = copy_from_user_toio(dma_buf, buf, bytes);
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1224 else
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1225 ret = copy_from_user((void __force *)dma_buf, buf, bytes);
^^^^^^^^^^^^^^
Positives are treated as success in _soc_component_ret()

e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1226 } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1227 if (is_cdc_dma_port(dai_id))
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1228 ret = copy_to_user_fromio(buf, dma_buf, bytes);
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1229 else
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1230 ret = copy_to_user(buf, (void __force *)dma_buf, bytes);

Same

e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1231 }
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1232
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 @1233 return ret;
e81c7e5d842d2b Srinivasa Rao Mandadapu 2022-02-14 1234 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx