Re: [PATCH] ASoC: meson: aiu: Fix resource leak
From: Valerio Setti
Date: Fri Jul 10 2026 - 08:53:46 EST
On 7/10/26 1:27 PM, Markus Elfring wrote:
…
+++ b/sound/soc/meson/aiu.c
@@ -310,7 +310,7 @@ static int aiu_probe(struct platform_device *pdev)
ARRAY_SIZE(aiu_cpu_dai_drv));
if (ret) {
dev_err(dev, "Failed to register cpu component\n");
- return ret;
+ goto err;
}
/* Register the hdmi codec control component */
Technically the fix is OK, …
I doubt it.
How can a snd_soc_unregister_component(dev) call ever fit to a failed
snd_soc_register_component() call (according to the presented suggestion)?
https://elixir.bootlin.com/linux/v7.2-rc1/source/sound/soc/meson/aiu.c#L240-L315
The reply was based on the fact that looking at 'snd_soc_unregister_component' that's a macro for 'snd_soc_unregister_component_by_driver'. The latter cycles through all registered components and if nothing is found related to the given dev, then it results in a no-op.
So calling 'snd_soc_unregister_component' on a failed 'snd_soc_register_component' looked harmless to me.
What did I miss?
--
Valerio