git: 332d81cd2f0c - stable/15 - sound: Reuse mixer_delete() in mixer_uninit()

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Sun, 18 Oct 2026 08:13:28 UTC
The branch stable/15 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=332d81cd2f0c21522151e82d0aafa44a8ffdf797

commit 332d81cd2f0c21522151e82d0aafa44a8ffdf797
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-09-18 18:18:01 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-10-18 08:10:49 +0000

    sound: Reuse mixer_delete() in mixer_uninit()
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D59077
    
    (cherry picked from commit 6c735475aeefc626962818c0ab8749aaeb6de9a4)
---
 sys/dev/sound/pcm/mixer.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c
index c0d05b5d195d..19bb28cbb939 100644
--- a/sys/dev/sound/pcm/mixer.c
+++ b/sys/dev/sound/pcm/mixer.c
@@ -519,8 +519,6 @@ int
 mixer_delete(struct snd_mixer *m)
 {
 	KASSERT(m != NULL, ("NULL snd_mixer"));
-	KASSERT(m->type == MIXER_TYPE_SECONDARY,
-	    ("%s(): illegal mixer type=%d", __func__, m->type));
 
 	/* mixer uninit can sleep --hps */
 
@@ -633,11 +631,7 @@ mixer_uninit(device_t dev)
 
 	/* mixer uninit can sleep --hps */
 
-	MIXER_UNINIT(m);
-
-	if (m->type == MIXER_TYPE_SECONDARY)
-		mtx_destroy(m->lock);
-	kobj_delete((kobj_t)m, M_DEVBUF);
+	mixer_delete(m);
 
 	return 0;
 }