]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - sound/soc/soc-dapm.c
Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[linux.git] / sound / soc / soc-dapm.c
index 2d9709104ec55e026322f50d58d52b41a0bba4be..255cad43a972119622d5eb1cb2b3bf9e151ac06e 100644 (file)
@@ -433,6 +433,8 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
 static void dapm_kcontrol_free(struct snd_kcontrol *kctl)
 {
        struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl);
+
+       list_del(&data->paths);
        kfree(data->wlist);
        kfree(data);
 }
@@ -724,18 +726,14 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm,
                item = 0;
        }
 
-       for (i = 0; i < e->items; i++) {
-               if (!(strcmp(control_name, e->texts[i]))) {
-                       path->name = e->texts[i];
-                       if (i == item)
-                               path->connect = 1;
-                       else
-                               path->connect = 0;
-                       return 0;
-               }
-       }
+       i = match_string(e->texts, e->items, control_name);
+       if (i < 0)
+               return -ENODEV;
+
+       path->name = e->texts[i];
+       path->connect = (i == item);
+       return 0;
 
-       return -ENODEV;
 }
 
 /* set up initial codec paths */
@@ -1088,7 +1086,7 @@ static int dapm_widget_list_create(struct snd_soc_dapm_widget_list **list,
        list_for_each(it, widgets)
                size++;
 
-       *list = kzalloc(sizeof(**list) + size * sizeof(*w), GFP_KERNEL);
+       *list = kzalloc(struct_size(*list, widgets, size), GFP_KERNEL);
        if (*list == NULL)
                return -ENOMEM;