|
@@ -230,6 +230,12 @@ static int capture_hw_params(struct snd_pcm_substream *substream,
|
|
|
struct snd_pcm_hw_params *hw_params)
|
|
|
{
|
|
|
struct snd_dice *dice = 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(&dice->mutex);
|
|
@@ -240,13 +246,18 @@ static int capture_hw_params(struct snd_pcm_substream *substream,
|
|
|
amdtp_stream_set_pcm_format(&dice->tx_stream,
|
|
|
params_format(hw_params));
|
|
|
|
|
|
- return snd_pcm_lib_alloc_vmalloc_buffer(substream,
|
|
|
- params_buffer_bytes(hw_params));
|
|
|
+ return 0;
|
|
|
}
|
|
|
static int playback_hw_params(struct snd_pcm_substream *substream,
|
|
|
struct snd_pcm_hw_params *hw_params)
|
|
|
{
|
|
|
struct snd_dice *dice = 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(&dice->mutex);
|
|
@@ -257,8 +268,7 @@ static int playback_hw_params(struct snd_pcm_substream *substream,
|
|
|
amdtp_stream_set_pcm_format(&dice->rx_stream,
|
|
|
params_format(hw_params));
|
|
|
|
|
|
- return snd_pcm_lib_alloc_vmalloc_buffer(substream,
|
|
|
- params_buffer_bytes(hw_params));
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
static int capture_hw_free(struct snd_pcm_substream *substream)
|