]> exis.tech > repos - linux.git/commit
ALSA: core: Add scoped cleanup helper for card references
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Thu, 4 Jun 2026 04:48:13 +0000 (01:48 -0300)
committerTakashi Iwai <tiwai@suse.de>
Thu, 4 Jun 2026 08:20:41 +0000 (10:20 +0200)
commitc6c6f0aec6fb4cbcc547bb265315fd76f18be731
tree397dec1d2152b1eb96dceb63b82ec449b59192a5
parent83615ff7c61ce2336b81b68cfbba6eadaf7843e9
ALSA: core: Add scoped cleanup helper for card references

Several ALSA paths acquire temporary card references with snd_card_ref()
and release them manually with snd_card_unref(). control_led.c already
defines a local cleanup helper for this pattern, while other core paths
still open-code the release.

Move the helper to the common ALSA core header and use it in control-layer
card-reference paths. This makes the ownership rule explicit and avoids
future missing-unref mistakes when adding early exits.

No functional change is intended.

Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260604-alsa-scoped-cleanups-v1-2-10c43152a728@gmail.com
include/sound/core.h
sound/core/control.c
sound/core/control_led.c