From: Takashi Iwai <tiwai@suse.de>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>, <tiwai@suse.com>,
<broonie@kernel.org>, <perex@perex.cz>, <amade@asmblr.net>,
<kuninori.morimoto.gx@renesas.com>, <linux-sound@vger.kernel.org>
Subject: Re: [PATCH v6] ALSA: control: Verify put() result when in debug mode
Date: Tue, 24 Feb 2026 16:59:17 +0100 [thread overview]
Message-ID: <875x7mf7ze.wl-tiwai@suse.de> (raw)
In-Reply-To: <8cfa8e20-1b6a-4d8f-8914-e085e839d250@intel.com>
On Tue, 24 Feb 2026 16:46:55 +0100,
Cezary Rojewski wrote:
>
> On 2026-02-24 1:09 PM, Takashi Iwai wrote:
> > On Mon, 23 Feb 2026 15:49:37 +0100,
> > Cezary Rojewski wrote:
>
> ...
>
> >> --- a/sound/core/init.c
> >> +++ b/sound/core/init.c
> > (snip)
> >> @@ -537,6 +542,9 @@ void snd_card_disconnect(struct snd_card *card)
> >> synchronize_irq(card->sync_irq);
> >> snd_info_card_disconnect(card);
> >> +#ifdef CONFIG_SND_CTL_DEBUG
> >> + kfree(card->value_buf);
> >> +#endif
> >> #ifdef CONFIG_SND_DEBUG
> >> debugfs_remove(card->debugfs_root);
> >> card->debugfs_root = NULL;
> >
> > IMO, it's better to be put in snd_card_do_free() which is the place to
> > release the actual resources.
>
> No problem, a question though - I've written the above to be cohesive
> as CONFIG_SND_DEBUG-part isn't part of snd_card_do_free() and what I'm
> adding is definitely also of debug-related capability. IIRC
> debugfs_remove() may invoke kfree() operations. Why isn't it part of
> snd_card_do_free() too?
The *_disconnect() is a stage to stop the operation and disconnect the
interfaces from user-space, so debugfs_remove() is invoked there.
You can do kfree() if all things are detached, but in general we do
the release in a later phase, as some objects may be still alive.
snd_card_do_free() is the actual destructor for the resources, where
all things can be safely freed.
Takashi
next prev parent reply other threads:[~2026-02-24 15:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 14:49 [PATCH v6] ALSA: control: Verify put() result when in debug mode Cezary Rojewski
2026-02-24 12:09 ` Takashi Iwai
2026-02-24 15:46 ` Cezary Rojewski
2026-02-24 15:59 ` Takashi Iwai [this message]
2026-02-24 13:21 ` Jaroslav Kysela
2026-02-24 15:36 ` Cezary Rojewski
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=875x7mf7ze.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=amade@asmblr.net \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-sound@vger.kernel.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