Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 May 2025 11:44:15 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 3de66f369c1e - stable/14 - sound: Call PCM_RELEASE() if pcm_addchan() fails
Message-ID:  <202505141144.54EBiFKI060205@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=3de66f369c1e8db46ae938d446a72f6ff3493356

commit 3de66f369c1e8db46ae938d446a72f6ff3493356
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-05-13 22:02:41 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-05-14 11:42:05 +0000

    sound: Call PCM_RELEASE() if pcm_addchan() fails
    
    Fixes:          fd906e47b18f ("sound: Simplify locking during device creation")
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 day
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D50337
    
    (cherry picked from commit dbfe79bbe5d5ebe296fbff2d101e0994d7881d0d)
---
 sys/dev/sound/pcm/sound.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 794e1586b511..cfac8f73990d 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -139,6 +139,7 @@ pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo)
 {
 	struct snddev_info *d = device_get_softc(dev);
 	struct pcm_channel *ch;
+	int err = 0;
 
 	PCM_LOCK(d);
 	PCM_WAIT(d);
@@ -147,13 +148,12 @@ pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo)
 	if (!ch) {
 		device_printf(d->dev, "chn_init(%s, %d, %p) failed\n",
 		    cls->name, dir, devinfo);
-		PCM_UNLOCK(d);
-		return (ENODEV);
+		err = ENODEV;
 	}
 	PCM_RELEASE(d);
 	PCM_UNLOCK(d);
 
-	return (0);
+	return (err);
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505141144.54EBiFKI060205>