ASoC: dmaengine: Fix missing __user prefix in copy_user callback

It seems that __user prefix was forgotten to be added to
dmaengine_copy_user callback while we refactored the user-copy PCM
core.

This patch adds the missing prefix, remove the superfluous cast, and
add the needed cast (__force is needed for downgrading from user
pointer to kernel pointer), too.

Spotted by a sparse warning like:
  sound/soc/soc-generic-dmaengine-pcm.c:397:27: warning: incorrect type in initializer (incompatible argument 4 (different address spaces))

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Takashi Iwai 2018-07-25 22:42:08 +02:00 committed by Mark Brown
parent c889a45d22
commit 40d1299f87
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 4 additions and 5 deletions

View File

@ -334,7 +334,7 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer(
static int dmaengine_copy_user(struct snd_pcm_substream *substream, static int dmaengine_copy_user(struct snd_pcm_substream *substream,
int channel, unsigned long hwoff, int channel, unsigned long hwoff,
void *buf, unsigned long bytes) void __user *buf, unsigned long bytes)
{ {
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_component *component = struct snd_soc_component *component =
@ -350,18 +350,17 @@ static int dmaengine_copy_user(struct snd_pcm_substream *substream,
int ret; int ret;
if (is_playback) if (is_playback)
if (copy_from_user(dma_ptr, (void __user *)buf, bytes)) if (copy_from_user(dma_ptr, buf, bytes))
return -EFAULT; return -EFAULT;
if (process) { if (process) {
ret = process(substream, channel, hwoff, ret = process(substream, channel, hwoff, (__force void *)buf, bytes);
(void __user *)buf, bytes);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
if (!is_playback) if (!is_playback)
if (copy_to_user((void __user *)buf, dma_ptr, bytes)) if (copy_to_user(buf, dma_ptr, bytes))
return -EFAULT; return -EFAULT;
return 0; return 0;