* [PATCH] ASoC: meson: aiu: Fix resource leak
@ 2026-07-07 1:24 Ethan Tidmore
2026-07-07 1:34 ` sashiko-bot
2026-07-07 20:33 ` Valerio Setti
0 siblings, 2 replies; 6+ messages in thread
From: Ethan Tidmore @ 2026-07-07 1:24 UTC (permalink / raw)
To: Jerome Brunet, Liam Girdwood, Mark Brown, Valerio Setti
Cc: Jaroslav Kysela, Takashi Iwai, Neil Armstrong, Kevin Hilman,
Martin Blumenstingl, linux-sound, linux-arm-kernel, linux-amlogic,
linux-kernel, Ethan Tidmore
In snd_soc_register_component() error path, the aiu-formatter is not
being freed. Instead of returning now goto the err tag so the
aiu-formatter can properly be freed.
Fixes: 83b83024cdbfd ("ASoC: meson: aiu: use aiu-formatter-i2s to format I2S output data")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
sound/soc/meson/aiu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c
index 64ace4d25d92..d6b644a53f7e 100644
--- a/sound/soc/meson/aiu.c
+++ 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 */
--
Thanks,
ET
https://github.com/sponsors/ethantidmore
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: meson: aiu: Fix resource leak
2026-07-07 1:24 [PATCH] ASoC: meson: aiu: Fix resource leak Ethan Tidmore
@ 2026-07-07 1:34 ` sashiko-bot
2026-07-07 1:41 ` Ethan Tidmore
2026-07-07 20:33 ` Valerio Setti
1 sibling, 1 reply; 6+ messages in thread
From: sashiko-bot @ 2026-07-07 1:34 UTC (permalink / raw)
To: Ethan Tidmore; +Cc: neil.armstrong, linux-amlogic
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch modifies the error path to purportedly free the `aiu-formatter` resource by jumping to the `err` label, referencing commit 83b83024cdbfd. However, the `aiu-formatter` allocation and cleanup code (specifically `gx_formatter_create` and `gx_formatter_free`) does not exist in the codebase at this revision. The patch is a "ghost fix" attempting to resolve a resource leak for a feature that is missing in this tree.
--
--- Patch [1]: [PATCH] ASoC: meson: aiu: Fix resource leak ---
commit e1f43f4a59c62657488472af87aa2e5d80576b03
Author: Ethan Tidmore <ethantidmore06@gmail.com>
ASoC: meson: aiu: Fix resource leak
This commit changes an error path in aiu_probe() to use a goto label
instead of returning directly. The commit message indicates this is to
ensure the aiu-formatter is properly freed when component registration
fails.
> diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c
> index f2890111c1d2c..1cfa165fb9cfc 100644
> --- a/sound/soc/meson/aiu.c
> +++ b/sound/soc/meson/aiu.c
[ ... ]
> @@ -288,7 +288,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;
[Severity: Medium]
Is there a missing dependency for this patch, or is it an incomplete
backport?
The commit message mentions that the aiu-formatter is not being freed.
However, looking at aiu_probe() in this tree, there is no aiu-formatter
allocation or cleanup code present anywhere in the function.
> }
>
> /* Register the hdmi codec control component */
[ ... ]
> err:
> snd_soc_unregister_component(dev);
> return ret;
> }
[Severity: Medium]
At this error label, only snd_soc_unregister_component() is called,
and no formatter cleanup logic exists. Does this fix apply to a
different tree where the formatter feature is actually present?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260707012424.1661733-1-ethantidmore06@gmail.com?part=1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: meson: aiu: Fix resource leak
2026-07-07 1:34 ` sashiko-bot
@ 2026-07-07 1:41 ` Ethan Tidmore
0 siblings, 0 replies; 6+ messages in thread
From: Ethan Tidmore @ 2026-07-07 1:41 UTC (permalink / raw)
To: sashiko-reviews, Ethan Tidmore; +Cc: neil.armstrong, linux-amlogic
On Mon Jul 6, 2026 at 8:34 PM CDT, sashiko-bot wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] The patch modifies the error path to purportedly free the `aiu-formatter` resource by jumping to the `err` label, referencing commit 83b83024cdbfd. However, the `aiu-formatter` allocation and cleanup code (specifically `gx_formatter_create` and `gx_formatter_free`) does not exist in the codebase at this revision. The patch is a "ghost fix" attempting to resolve a resource leak for a feature that is missing in this tree.
> --
This bug exists in linux-next. The AI is using the mainline.
--
Thanks,
ET
https://github.com/sponsors/ethantidmore
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: meson: aiu: Fix resource leak
2026-07-07 1:24 [PATCH] ASoC: meson: aiu: Fix resource leak Ethan Tidmore
2026-07-07 1:34 ` sashiko-bot
@ 2026-07-07 20:33 ` Valerio Setti
2026-07-10 11:27 ` Markus Elfring
1 sibling, 1 reply; 6+ messages in thread
From: Valerio Setti @ 2026-07-07 20:33 UTC (permalink / raw)
To: Ethan Tidmore, Jerome Brunet, Liam Girdwood, Mark Brown
Cc: Jaroslav Kysela, Takashi Iwai, Neil Armstrong, Kevin Hilman,
Martin Blumenstingl, linux-sound, linux-arm-kernel, linux-amlogic,
linux-kernel
On 7/7/26 3:24 AM, Ethan Tidmore wrote:
> In snd_soc_register_component() error path, the aiu-formatter is not
> being freed. Instead of returning now goto the err tag so the
> aiu-formatter can properly be freed.
>
> Fixes: 83b83024cdbfd ("ASoC: meson: aiu: use aiu-formatter-i2s to format I2S output data")
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
> ---
> sound/soc/meson/aiu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c
> index 64ace4d25d92..d6b644a53f7e 100644
> --- a/sound/soc/meson/aiu.c
> +++ 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, but I don't think the commit title and
message are correct. aiu-formatter data is allocated in
'gx_formatter_create' using 'devm_kzalloc' so, unless I'm missing
something, the data should be automatically freed when the device is
removed in case of error.
What 'gx_formatter_free' does is simply clearing widget's private
pointer (i.e. 'w->priv'). I think that not clearing it should not have
any bad consequence since the pointer would be overwritten on the next
probe. However I agree that for consistency reasons it's a good thing to
clear to do when 'aiu_probe' fails.
So perhaps the title should be rewritten to something like "ASoC: meson:
aiu: reset widget private data on probe error path"?
--
Valerio
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: meson: aiu: Fix resource leak
2026-07-07 20:33 ` Valerio Setti
@ 2026-07-10 11:27 ` Markus Elfring
2026-07-10 12:47 ` Valerio Setti
0 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2026-07-10 11:27 UTC (permalink / raw)
To: Valerio Setti, Ethan Tidmore, linux-sound, linux-amlogic,
linux-arm-kernel, Jerome Brunet, Liam Girdwood, Mark Brown
Cc: LKML, Jaroslav Kysela, Kevin Hilman, Martin Blumenstingl,
Neil Armstrong, Takashi Iwai
…
> > +++ 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
Regards,
Markus
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: meson: aiu: Fix resource leak
2026-07-10 11:27 ` Markus Elfring
@ 2026-07-10 12:47 ` Valerio Setti
0 siblings, 0 replies; 6+ messages in thread
From: Valerio Setti @ 2026-07-10 12:47 UTC (permalink / raw)
To: Markus Elfring, Ethan Tidmore, linux-sound, linux-amlogic,
linux-arm-kernel, Jerome Brunet, Liam Girdwood, Mark Brown
Cc: LKML, Jaroslav Kysela, Kevin Hilman, Martin Blumenstingl,
Neil Armstrong, Takashi Iwai
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
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-07-10 12:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07 1:24 [PATCH] ASoC: meson: aiu: Fix resource leak Ethan Tidmore
2026-07-07 1:34 ` sashiko-bot
2026-07-07 1:41 ` Ethan Tidmore
2026-07-07 20:33 ` Valerio Setti
2026-07-10 11:27 ` Markus Elfring
2026-07-10 12:47 ` Valerio Setti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox