@@ -939,19 +939,23 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
return -EPROBE_DEFER;
}
+static void soc_cleanup_component(struct snd_soc_component *component)
+{
+ list_del(&component->card_list);
+ soc_cleanup_component_debugfs(component);
+ component->card = NULL;
+ module_put(component->dev->driver->owner);
+}
+
static void soc_remove_component(struct snd_soc_component *component)
{
if (!component->card)
return;
- list_del(&component->card_list);
-
if (component->driver->remove)
component->driver->remove(component);
- soc_cleanup_component_debugfs(component);
- component->card = NULL;
- module_put(component->dev->driver->owner);
+ soc_cleanup_component(component);
}
static void soc_remove_dai(struct snd_soc_dai *dai, int order)
@@ -1333,6 +1337,7 @@ static int soc_probe_component(struct snd_soc_card *card,
component->card = card;
dapm->card = card;
INIT_LIST_HEAD(&dapm->list);
+ INIT_LIST_HEAD(&component->card_list);
soc_set_name_prefix(card, component);
soc_init_component_debugfs(component);
@@ -1395,12 +1400,9 @@ static int soc_probe_component(struct snd_soc_card *card,
/* see for_each_card_components */
list_add(&component->card_list, &card->component_dev_list);
- return 0;
-
err_probe:
- soc_cleanup_component_debugfs(component);
- component->card = NULL;
- module_put(component->dev->driver->owner);
+ if (ret < 0)
+ soc_cleanup_component(component);
return ret;
}