diff options
Diffstat (limited to 'sound/soc/soc-dapm.c')
| -rw-r--r-- | sound/soc/soc-dapm.c | 24 | 
1 files changed, 11 insertions, 13 deletions
| diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 2d9709104ec5..229c12349803 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -433,6 +433,8 @@ err_data:  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; @@ -3057,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) { |