Unverified Commit bee87cf0 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown
Browse files

ASoC: cs35l56: Don't use devres to unregister component

Manually call snd_soc_unregister_component() from cs35l56_remove()
instead of using devres cleanup. This ensures that the component is
destroyed before cs35l56_remove() starts cleanup of anything the
component code could be using.

Devres cleanup happens after the driver remove() callback, so if
snd_soc_register_component() is used, it will not be destroyed until
after cs35l56_remove() has returned. But there is some cleanup that
must be done in cs35l56_remove(), or wrapped in a custom devres
cleanup handler to ensure correct ordering. The simplest option is
to call snd_soc_unregister_component() at the start of cs35l56_remove().

Fixes: e4961125 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56")
Closes: https://sashiko.dev/#/patchset/20260501103002.2843735-1-rf%40opensource.cirrus.com


Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20260505161124.3621000-2-rf@opensource.cirrus.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7fd2df20
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -1956,7 +1956,7 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56)
		goto err;
	}

	ret = devm_snd_soc_register_component(cs35l56->base.dev,
	ret = snd_soc_register_component(cs35l56->base.dev,
					 &soc_component_dev_cs35l56,
					 cs35l56_dai, ARRAY_SIZE(cs35l56_dai));
	if (ret < 0) {
@@ -2057,6 +2057,8 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_init, "SND_SOC_CS35L56_CORE");

void cs35l56_remove(struct cs35l56_private *cs35l56)
{
	snd_soc_unregister_component(cs35l56->base.dev);

	cs35l56->base.init_done = false;

	/*