diff --git a/drivers/staging/line6/capture.c b/drivers/staging/line6/capture.c index ba441ed1a876727c70871524e2bf26fe55889a6d..8f59ff3e7a175f12797ad0296e32dc01027afefc 100644 --- a/drivers/staging/line6/capture.c +++ b/drivers/staging/line6/capture.c @@ -316,8 +316,11 @@ static int snd_line6_capture_hw_params(struct snd_pcm_substream *substream, } /* -- [FD] end */ - line6pcm->buffer_in = kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * - line6pcm->max_packet_size, GFP_KERNEL); + /* We may be invoked multiple times in a row so allocate once only */ + if (!line6pcm->buffer_in) + line6pcm->buffer_in = + kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * + line6pcm->max_packet_size, GFP_KERNEL); if (!line6pcm->buffer_in) { dev_err(line6pcm->line6->ifcdev, diff --git a/drivers/staging/line6/playback.c b/drivers/staging/line6/playback.c index e495b32ed7dffffcd485e0d1985c6f6ead033160..ed1b9bd93ff8d7ef1bb594bdd5bf5ddaa6f728fd 100644 --- a/drivers/staging/line6/playback.c +++ b/drivers/staging/line6/playback.c @@ -462,8 +462,11 @@ static int snd_line6_playback_hw_params(struct snd_pcm_substream *substream, } /* -- [FD] end */ - line6pcm->buffer_out = kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * - line6pcm->max_packet_size, GFP_KERNEL); + /* We may be invoked multiple times in a row so allocate once only */ + if (!line6pcm->buffer_out) + line6pcm->buffer_out = + kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * + line6pcm->max_packet_size, GFP_KERNEL); if (!line6pcm->buffer_out) { dev_err(line6pcm->line6->ifcdev,