]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ASoC: generic: keep fallback dai_name stable across rebind
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Fri, 27 Mar 2026 17:16:27 +0000 (14:16 -0300)
committerMark Brown <broonie@kernel.org>
Mon, 30 Mar 2026 19:06:54 +0000 (20:06 +0100)
commitaa173b70d3720afabd2ba333838339ca24bc40da
tree759e6604d2421b73da8888f9e2beaa3a38b1350a
parent18cc8cc30b71feaec4d80724917f91782987a4a7
ASoC: generic: keep fallback dai_name stable across rebind

simple_parse_dai() and graph_util_parse_dai() first try to identify a
DAI via dai_args. When that works the card can rebind without relying on
dlc->dai_name.

The fallback path still calls snd_soc_get_dlc(), which returns a
borrowed dai_name pointer. If the CPU or codec component is unbound
while the sound card stays registered, the generic card keeps that
pointer and the next rebind may compare stale memory while matching the
DAI.

Stage the fallback result in a temporary dai_link_component and move
only a card-owned copy of dai_name into the live link component. Use
devm_kstrdup_const() so static names are reused and dynamic ones remain
valid for the lifetime of the card device.

Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260327-asoc-generic-fallback-dai-name-rebind-v3-1-c206e44f40c8@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/simple-card-utils.c
sound/soc/generic/simple-card.c