The branch main has been updated by christos:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=47cf9dc7861371edcfdb85a38e2c240f430ccb28

commit 47cf9dc7861371edcfdb85a38e2c240f430ccb28
Author:     Christos Margiolis <[email protected]>
AuthorDate: 2026-09-18 18:18:20 +0000
Commit:     Christos Margiolis <[email protected]>
CommitDate: 2026-09-18 18:18:20 +0000

    sound: Lock around mixer_set*() in mixer_init() for consistency
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D59110
---
 sys/dev/sound/pcm/mixer.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c
index ff591cef799f..e3782e7ace04 100644
--- a/sys/dev/sound/pcm/mixer.c
+++ b/sys/dev/sound/pcm/mixer.c
@@ -557,6 +557,9 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
        if (m == NULL)
                return (-1);
 
+       /* There is no need to lock here, but do it for consistency. */
+       mtx_lock(m->lock);
+
        for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
                v = snd_mixerdefaults[i];
 
@@ -572,6 +575,8 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
 
        mixer_setrecsrc(m, 0); /* Set default input. */
 
+       mtx_unlock(m->lock);
+
        snddev->mixer = m;
 
        if (bootverbose) {

Reply via email to