mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: core: Make sure to call snd_card_disconnect() at freeing
@ 2026-10-01 13:18 Takashi Iwai
  2026-10-01 15:06 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Iwai @ 2026-10-01 13:18 UTC (permalink / raw)
  To: linux-sound; +Cc: linux-kernel

When a card object gets freed via devres, it might be freed without
calling snd_card_disconnect(), and it might forget to release some
resources such as the procfs that gets deleted at the disconnect call.

Add an explicit call of snd_card_disconnect() at snd_card_do_free()
for assuring the preparation for cleanup.

Fixes: e8ad415b7a55 ("ALSA: core: Add managed card creation")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

This patch is required as a prerequisite for the recent cleanup series
to use auto-cleanup:
  http://lore.kernel.org/20261001110447.486782-1-tiwai@suse.de

 sound/core/init.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/core/init.c b/sound/core/init.c
index 0897b3a11617..764d3d1073e7 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -564,6 +564,10 @@ static int snd_card_do_free(struct snd_card *card)
 	bool managed = card->managed;
 
 	card->releasing = true;
+
+	/* for case without explicit disconnect call (e.g. via devres) */
+	snd_card_disconnect(card);
+
 #if IS_ENABLED(CONFIG_SND_MIXER_OSS)
 	if (snd_mixer_oss_notify_callback)
 		snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE);
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-01 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 13:18 [PATCH] ALSA: core: Make sure to call snd_card_disconnect() at freeing Takashi Iwai
2026-10-01 15:06 ` Takashi Iwai

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®