From 3101ba035ca9ba92f6cec7fd37348646b7a5cb61 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 12 Jul 2011 08:05:16 +0200 Subject: ALSA: Use krealloc() in possible places Signed-off-by: Takashi Iwai --- sound/core/rawmidi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound/core') diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 0757f542999..849a0ed9505 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -626,10 +626,10 @@ int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream, return -EINVAL; } if (params->buffer_size != runtime->buffer_size) { - newbuf = kmalloc(params->buffer_size, GFP_KERNEL); + newbuf = krealloc(runtime->buffer, params->buffer_size, + GFP_KERNEL); if (!newbuf) return -ENOMEM; - kfree(runtime->buffer); runtime->buffer = newbuf; runtime->buffer_size = params->buffer_size; runtime->avail = runtime->buffer_size; @@ -653,10 +653,10 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, return -EINVAL; } if (params->buffer_size != runtime->buffer_size) { - newbuf = kmalloc(params->buffer_size, GFP_KERNEL); + newbuf = krealloc(runtime->buffer, params->buffer_size, + GFP_KERNEL); if (!newbuf) return -ENOMEM; - kfree(runtime->buffer); runtime->buffer = newbuf; runtime->buffer_size = params->buffer_size; } -- cgit v1.2.3-70-g09d2