Merge branch 'asoc-4.18' into asoc-4.19 for amd dep
[muen/linux.git] / sound / soc / soc-dapm.c
index 8ede773b1db8fcf102ee45b0c471d9ee3057430f..a099c3e4550478e81b16546bfc0012e407d15d24 100644 (file)
@@ -1086,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;
 
@@ -3055,7 +3055,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
                        continue;
 
                if (w->num_kcontrols) {
-                       w->kcontrols = kzalloc(w->num_kcontrols *
+                       w->kcontrols = kcalloc(w->num_kcontrols,
                                                sizeof(struct snd_kcontrol *),
                                                GFP_KERNEL);
                        if (!w->kcontrols) {