It is still using snd_soc_{un}register_dai() manually. Let's use devm_snd_soc_register_dai(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> --- sound/soc/soc-core.c | 42 ++++++++++-------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a5b96c17633a..7284363b9088 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2552,48 +2552,28 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, EXPORT_SYMBOL_GPL(snd_soc_register_dai); /** - * snd_soc_unregister_dais - Unregister DAIs from the ASoC core - * - * @component: The component for which the DAIs should be unregistered - */ -static void snd_soc_unregister_dais(struct snd_soc_component *component) -{ - struct snd_soc_dai *dai, *_dai; - - for_each_component_dais_safe(component, dai, _dai) - snd_soc_unregister_dai(dai); -} - -/** - * snd_soc_register_dais - Register a DAI with the ASoC core + * devm_snd_soc_register_dais - Register a DAI with the ASoC core * * @component: The component the DAIs are registered for * @dai_drv: DAI driver to use for the DAIs * @count: Number of DAIs */ -static int snd_soc_register_dais(struct snd_soc_component *component, - struct snd_soc_dai_driver *dai_drv, - size_t count) +static int devm_snd_soc_register_dais(struct snd_soc_component *component, + struct snd_soc_dai_driver *dai_drv, + size_t count) { struct snd_soc_dai *dai; unsigned int i; - int ret; for (i = 0; i < count; i++) { - dai = snd_soc_register_dai(component, dai_drv + i, count == 1 && - component->driver->legacy_dai_naming); - if (dai == NULL) { - ret = -ENOMEM; - goto err; - } + dai = devm_snd_soc_register_dai(component->dev, + component, dai_drv + i, count == 1 && + component->driver->legacy_dai_naming); + if (!dai) + return -ENOMEM; } return 0; - -err: - snd_soc_unregister_dais(component); - - return ret; } #define ENDIANNESS_MAP(name) \ @@ -2644,8 +2624,6 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component) { struct snd_soc_card *card = component->card; - snd_soc_unregister_dais(component); - if (card) snd_soc_unbind_card(card, false); @@ -2696,7 +2674,7 @@ int snd_soc_add_component(struct snd_soc_component *component, } } - ret = snd_soc_register_dais(component, dai_drv, num_dai); + ret = devm_snd_soc_register_dais(component, dai_drv, num_dai); if (ret < 0) { dev_err(component->dev, "ASoC: Failed to register DAIs: %d\n", ret); -- 2.25.1