diff options
| author | Cássio Gabriel <cassiogabrielcontato@gmail.com> | 2026-06-04 07:48:13 +0300 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-06-04 11:20:41 +0300 |
| commit | c6c6f0aec6fb4cbcc547bb265315fd76f18be731 (patch) | |
| tree | 397dec1d2152b1eb96dceb63b82ec449b59192a5 /include | |
| parent | 83615ff7c61ce2336b81b68cfbba6eadaf7843e9 (diff) | |
| download | linux-c6c6f0aec6fb4cbcc547bb265315fd76f18be731.tar.xz | |
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
Diffstat (limited to 'include')
| -rw-r--r-- | include/sound/core.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index 4bb76c21c956..8b2ca95d13f7 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -319,6 +319,8 @@ static inline void snd_card_unref(struct snd_card *card) put_device(&card->card_dev); } +DEFINE_FREE(snd_card_unref, struct snd_card *, if (_T) snd_card_unref(_T)) + #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) /* device.c */ |
