Re: [PATCH] ASoC: meson: aiu: Fix resource leak

Valerio Setti <[email protected]>
Newsgroups org.infradead.lists.linux-amlogic,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound
Message-ID <[email protected]>

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


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.