git: 9e36026dc3ea - stable/14 - sound: Move sndstat_register() call to pcm_setstatus()

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 05 Nov 2024 21:45:34 UTC
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=9e36026dc3eafe158d03c9371abd784e4115f4f0

commit 9e36026dc3eafe158d03c9371abd784e4115f4f0
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-11-03 19:02:37 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-11-05 21:44:41 +0000

    sound: Move sndstat_register() call to pcm_setstatus()
    
    The d->status string is populated in pcm_setstatus() anyway, so call
    sndstat_register() after we populate it, and are closer to finalizing
    the device creation.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    dev_submerge.ch, markj
    Differential Revision:  https://reviews.freebsd.org/D47323
    
    (cherry picked from commit 181a31d8349088cbcead8dcbff8d62ee8af6c913)
---
 sys/dev/sound/pcm/sound.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 5ca38ca622c9..3c4fb38fa4f5 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -293,6 +293,7 @@ pcm_setstatus(device_t dev, char *str)
 	vchan_setmaxauto(d, snd_maxautovchans);
 
 	strlcpy(d->status, str, SND_STATUSLEN);
+	sndstat_register(dev, d->status);
 
 	PCM_LOCK(d);
 
@@ -509,8 +510,6 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
 	if (numplay > 0 || numrec > 0)
 		d->flags |= SD_F_AUTOVCHAN;
 
-	sndstat_register(dev, d->status);
-
 	return (0);
 }