mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valerio Setti <vsetti@baylibre.com>
To: Ethan Tidmore <ethantidmore06@gmail.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	linux-sound@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: meson: aiu: Fix resource leak
Date: Tue, 7 Jul 2026 22:33:58 +0200	[thread overview]
Message-ID: <b955120b-2c32-4b03-9e7f-f236692cfc7b@baylibre.com> (raw)
In-Reply-To: <20260707012424.1661733-1-ethantidmore06@gmail.com>



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


  reply	other threads:[~2026-07-07 20:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07  1:24 Ethan Tidmore
2026-07-07 20:33 ` Valerio Setti [this message]
2026-07-10 11:27   ` Markus Elfring
2026-07-10 12:47     ` Valerio Setti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b955120b-2c32-4b03-9e7f-f236692cfc7b@baylibre.com \
    --to=vsetti@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=ethantidmore06@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®