summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-07-22 08:43:24 +0200
committerTakashi Iwai <tiwai@suse.de>2011-07-22 08:43:24 +0200
commit7d339ae99758bc21033d4a19bcd4f7b55f96e24e (patch)
treea5bb46e47f7c4ae193cdf1a73c361144d6099df8 /sound/pci/hda/hda_codec.c
parent13b137ef0367237909bb2dc38babfb8305154676 (diff)
parent000477a0fe1af14355a52622a77ccce8bfd7230d (diff)
downloadop-kernel-dev-7d339ae99758bc21033d4a19bcd4f7b55f96e24e.zip
op-kernel-dev-7d339ae99758bc21033d4a19bcd4f7b55f96e24e.tar.gz
Merge branch 'topic/misc' into for-linus
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 45b4a8d..f26e487 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4957,17 +4957,15 @@ void *snd_array_new(struct snd_array *array)
{
if (array->used >= array->alloced) {
int num = array->alloced + array->alloc_align;
+ int size = (num + 1) * array->elem_size;
+ int oldsize = array->alloced * array->elem_size;
void *nlist;
if (snd_BUG_ON(num >= 4096))
return NULL;
- nlist = kcalloc(num + 1, array->elem_size, GFP_KERNEL);
+ nlist = krealloc(array->list, size, GFP_KERNEL);
if (!nlist)
return NULL;
- if (array->list) {
- memcpy(nlist, array->list,
- array->elem_size * array->alloced);
- kfree(array->list);
- }
+ memset(nlist + oldsize, 0, size - oldsize);
array->list = nlist;
array->alloced = num;
}
OpenPOWER on IntegriCloud