Commit 132b2605 authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by Wen Zhiwei
Browse files

ASoc: SOF: topology: Clear SOF link platform name upon unload

stable inclusion
from stable-v6.6.51
commit f39bde3f782570f44794ed9b0075d1e9057f849c
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAYRVR

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f39bde3f782570f44794ed9b0075d1e9057f849c



--------------------------------

[ Upstream commit e0be875c5bf03a9676a6bfed9e0f1766922a7dbd ]

The SOF topology loading function sets the device name for the platform
component link. This should be unset when unloading the topology,
otherwise a machine driver unbind/bind or reprobe would complain about
an invalid component as having both its component name and of_node set:

    mt8186_mt6366 sound: ASoC: Both Component name/of_node are set for AFE_SOF_DL1
    mt8186_mt6366 sound: error -EINVAL: Cannot register card
    mt8186_mt6366 sound: probe with driver mt8186_mt6366 failed with error -22

This happens with machine drivers that set the of_node separately.

Clear the SOF link platform name in the topology unload callback.

Fixes: 311ce4fe ("ASoC: SOF: Add support for loading topologies")
Signed-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Link: https://patch.msgid.link/20240821041006.2618855-1-wenst@chromium.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent 2eb56027
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2040,6 +2040,8 @@ static int sof_link_unload(struct snd_soc_component *scomp, struct snd_soc_dobj
	if (!slink)
		return 0;

	slink->link->platforms->name = NULL;

	kfree(slink->tuples);
	list_del(&slink->list);
	kfree(slink->hw_configs);