Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / sound / core / control.c
index 5be5b9b931bfefee5a2798775b7c33d02f42222e..7a4d8690ce41f4f0644dc007709fd071095439b7 100644 (file)
@@ -196,16 +196,12 @@ EXPORT_SYMBOL(snd_ctl_notify);
 static int snd_ctl_new(struct snd_kcontrol **kctl, unsigned int count,
                       unsigned int access, struct snd_ctl_file *file)
 {
-       unsigned int size;
        unsigned int idx;
 
        if (count == 0 || count > MAX_CONTROL_COUNT)
                return -EINVAL;
 
-       size  = sizeof(struct snd_kcontrol);
-       size += sizeof(struct snd_kcontrol_volatile) * count;
-
-       *kctl = kzalloc(size, GFP_KERNEL);
+       *kctl = kzalloc(struct_size(*kctl, vd, count), GFP_KERNEL);
        if (!*kctl)
                return -ENOMEM;