diff options
Diffstat (limited to 'sound/firewire/oxfw')
-rw-r--r-- | sound/firewire/oxfw/oxfw-pcm.c | 17 | ||||
-rw-r--r-- | sound/firewire/oxfw/oxfw-stream.c | 9 |
2 files changed, 16 insertions, 10 deletions
diff --git a/sound/firewire/oxfw/oxfw-pcm.c b/sound/firewire/oxfw/oxfw-pcm.c index 67ade0775a5b..9c73930d0278 100644 --- a/sound/firewire/oxfw/oxfw-pcm.c +++ b/sound/firewire/oxfw/oxfw-pcm.c @@ -231,7 +231,12 @@ static int pcm_capture_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { struct snd_oxfw *oxfw = substream->private_data; + int err; + err = snd_pcm_lib_alloc_vmalloc_buffer(substream, + params_buffer_bytes(hw_params)); + if (err < 0) + return err; if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) { mutex_lock(&oxfw->mutex); @@ -241,13 +246,18 @@ static int pcm_capture_hw_params(struct snd_pcm_substream *substream, amdtp_stream_set_pcm_format(&oxfw->tx_stream, params_format(hw_params)); - return snd_pcm_lib_alloc_vmalloc_buffer(substream, - params_buffer_bytes(hw_params)); + return 0; } static int pcm_playback_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { struct snd_oxfw *oxfw = substream->private_data; + int err; + + err = snd_pcm_lib_alloc_vmalloc_buffer(substream, + params_buffer_bytes(hw_params)); + if (err < 0) + return err; if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) { mutex_lock(&oxfw->mutex); @@ -257,8 +267,7 @@ static int pcm_playback_hw_params(struct snd_pcm_substream *substream, amdtp_stream_set_pcm_format(&oxfw->rx_stream, params_format(hw_params)); - return snd_pcm_lib_alloc_vmalloc_buffer(substream, - params_buffer_bytes(hw_params)); + return 0; } static int pcm_capture_hw_free(struct snd_pcm_substream *substream) diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c index 873d40fc4509..77ad5b98e806 100644 --- a/sound/firewire/oxfw/oxfw-stream.c +++ b/sound/firewire/oxfw/oxfw-stream.c @@ -512,12 +512,11 @@ assume_stream_formats(struct snd_oxfw *oxfw, enum avc_general_plug_dir dir, if (err < 0) goto end; - formats[eid] = kmalloc(*len, GFP_KERNEL); + formats[eid] = kmemdup(buf, *len, GFP_KERNEL); if (formats[eid] == NULL) { err = -ENOMEM; goto end; } - memcpy(formats[eid], buf, *len); /* apply the format for each available sampling rate */ for (i = 0; i < ARRAY_SIZE(oxfw_rate_table); i++) { @@ -531,12 +530,11 @@ assume_stream_formats(struct snd_oxfw *oxfw, enum avc_general_plug_dir dir, continue; eid++; - formats[eid] = kmalloc(*len, GFP_KERNEL); + formats[eid] = kmemdup(buf, *len, GFP_KERNEL); if (formats[eid] == NULL) { err = -ENOMEM; goto end; } - memcpy(formats[eid], buf, *len); formats[eid][2] = avc_stream_rate_table[i]; } @@ -594,12 +592,11 @@ static int fill_stream_formats(struct snd_oxfw *oxfw, if (err < 0) break; - formats[eid] = kmalloc(len, GFP_KERNEL); + formats[eid] = kmemdup(buf, len, GFP_KERNEL); if (formats[eid] == NULL) { err = -ENOMEM; break; } - memcpy(formats[eid], buf, len); /* get next entry */ len = AVC_GENERIC_FRAME_MAXIMUM_BYTES; |