diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-07-12 02:05:16 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-07-12 02:05:16 -0400 |
commit | 3101ba035ca9ba92f6cec7fd37348646b7a5cb61 (patch) | |
tree | 478b2181515e980f60707ac2bf4b21e65cbc0b4c /sound/core | |
parent | 08ef79490dad6b88010e94795cf9f89b018ed504 (diff) |
ALSA: Use krealloc() in possible places
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/rawmidi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 0757f542999d..849a0ed95054 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, | |||
626 | return -EINVAL; | 626 | return -EINVAL; |
627 | } | 627 | } |
628 | if (params->buffer_size != runtime->buffer_size) { | 628 | if (params->buffer_size != runtime->buffer_size) { |
629 | newbuf = kmalloc(params->buffer_size, GFP_KERNEL); | 629 | newbuf = krealloc(runtime->buffer, params->buffer_size, |
630 | GFP_KERNEL); | ||
630 | if (!newbuf) | 631 | if (!newbuf) |
631 | return -ENOMEM; | 632 | return -ENOMEM; |
632 | kfree(runtime->buffer); | ||
633 | runtime->buffer = newbuf; | 633 | runtime->buffer = newbuf; |
634 | runtime->buffer_size = params->buffer_size; | 634 | runtime->buffer_size = params->buffer_size; |
635 | runtime->avail = runtime->buffer_size; | 635 | runtime->avail = runtime->buffer_size; |
@@ -653,10 +653,10 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream, | |||
653 | return -EINVAL; | 653 | return -EINVAL; |
654 | } | 654 | } |
655 | if (params->buffer_size != runtime->buffer_size) { | 655 | if (params->buffer_size != runtime->buffer_size) { |
656 | newbuf = kmalloc(params->buffer_size, GFP_KERNEL); | 656 | newbuf = krealloc(runtime->buffer, params->buffer_size, |
657 | GFP_KERNEL); | ||
657 | if (!newbuf) | 658 | if (!newbuf) |
658 | return -ENOMEM; | 659 | return -ENOMEM; |
659 | kfree(runtime->buffer); | ||
660 | runtime->buffer = newbuf; | 660 | runtime->buffer = newbuf; |
661 | runtime->buffer_size = params->buffer_size; | 661 | runtime->buffer_size = params->buffer_size; |
662 | } | 662 | } |