From 73080a7976edde1c61f3654308ffe77c428ad6a2 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 15 Jul 2026 02:13:15 +0000 Subject: [PATCH] ASoC: generic: Card name parsing should be called after xxx_for_each_link() "tidyup simple_util_parse_xxx() in xxx_parse_of()" commit changed the function call order. But simple_util_parse_card_name() should be called after dai_link settings, because it might use dai_link->name as card->name. Fixes: fa6222d5e121 ("ASoC: audio-graph-card2: tidyup simple_util_parse_xxx() in audio_graph2_parse_of()") Fixes: b8081307f5c9 ("ASoC: audio-graph-card: tidyup simple_util_parse_xxx() in audio_graph_parse_of()") Fixes: 27ecf4da5ad3 ("ASoC: simple-card: tidyup simple_util_parse_xxx() in simple_parse_of()") Reported-by: Mark Brown Link: https://lore.kernel.org/r/b81ebfa2-6a35-4ff0-9d04-b867233eda4d@sirena.org.uk Reported-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20260714103428.2318895-1-geert+renesas@glider.be Signed-off-by: Kuninori Morimoto Tested-by: Geert Uytterhoeven Link: https://patch.msgid.link/87zezt0zlw.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/generic/audio-graph-card.c | 9 +++++---- sound/soc/generic/audio-graph-card2.c | 9 +++++---- sound/soc/generic/simple-card.c | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) 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;