diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 73ea562ce52b..0a8a6d891d1f 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -587,10 +587,6 @@ int audio_graph_parse_of(struct simple_util_priv *priv, struct device *dev) if (ret < 0) goto end; - ret = simple_util_parse_card_name(priv, NULL); - if (ret < 0) - goto err; - memset(li, 0, sizeof(*li)); ret = graph_for_each_link(priv, li, graph_dai_link_of, @@ -598,6 +594,11 @@ int audio_graph_parse_of(struct simple_util_priv *priv, struct device *dev) if (ret < 0) goto err; + /* Card name should be set after graph_for_each_link() */ + ret = simple_util_parse_card_name(priv, NULL); + if (ret < 0) + goto err; + snd_soc_card_set_drvdata(card, priv); simple_util_debug_info(priv); diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index e3e92025b317..9fb3d3df5cf6 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -1344,10 +1344,6 @@ int audio_graph2_parse_of(struct simple_util_priv *priv, struct device *dev, if (ret < 0) goto end; - ret = simple_util_parse_card_name(priv, NULL); - if (ret < 0) - goto err; - ret = simple_util_parse_aux_devs(priv, NULL); if (ret < 0) goto err; @@ -1357,6 +1353,11 @@ int audio_graph2_parse_of(struct simple_util_priv *priv, struct device *dev, if (ret < 0) goto err; + /* Card name should be set after graph_for_each_link() */ + ret = simple_util_parse_card_name(priv, NULL); + if (ret < 0) + goto err; + snd_soc_card_set_drvdata(card, priv); if ((hooks) && (hooks)->hook_post) { diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 6e98e973e525..e7ad7af04714 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -704,10 +704,6 @@ static int simple_parse_of(struct simple_util_priv *priv) if (ret < 0) goto end; - ret = simple_util_parse_card_name(priv, PREFIX); - if (ret < 0) - goto err; - ret = simple_util_parse_aux_devs(priv, PREFIX); if (ret < 0) goto err; @@ -720,6 +716,11 @@ static int simple_parse_of(struct simple_util_priv *priv) if (ret < 0) goto err; + /* Card name should be set after simple_for_each_link() */ + ret = simple_util_parse_card_name(priv, PREFIX); + if (ret < 0) + goto err; + ret = simple_populate_aux(priv); if (ret < 0) goto err;