{
        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;
  }