From: Takashi Iwai Date: Thu, 13 Nov 2008 13:38:00 +0000 (+0100) Subject: Merge branch 'topic/fix/hda' into topic/hda X-Git-Tag: firefly_0821_release~15381^2~45^2~68 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cd80bc6f4811b48eb68716c8255bf7e5f0006caa;p=firefly-linux-kernel-4.4.55.git Merge branch 'topic/fix/hda' into topic/hda Conflicts: sound/pci/hda/patch_sigmatel.c --- cd80bc6f4811b48eb68716c8255bf7e5f0006caa diff --cc sound/pci/hda/patch_sigmatel.c index ec8f5ab9c54d,1633ef2c654a..58d832c3835a --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@@ -2613,16 -2594,28 +2615,16 @@@ static int stac92xx_add_control_temp(st { struct snd_kcontrol_new *knew; - if (spec->num_kctl_used >= spec->num_kctl_alloc) { - int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; - - knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ - if (! knew) - return -ENOMEM; - if (spec->kctl_alloc) { - memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); - kfree(spec->kctl_alloc); - } - spec->kctl_alloc = knew; - spec->num_kctl_alloc = num; - } - - knew = &spec->kctl_alloc[spec->num_kctl_used]; + snd_array_init(&spec->kctls, sizeof(*knew), 32); + knew = snd_array_new(&spec->kctls); + if (!knew) + return -ENOMEM; - *knew = stac92xx_control_templates[type]; + *knew = *ktemp; knew->index = idx; knew->name = kstrdup(name, GFP_KERNEL); - if (! knew->name) + if (!knew->name) return -ENOMEM; knew->private_value = val; - spec->num_kctl_used++; return 0; }