git: dbfe79bbe5d5 - main - sound: Call PCM_RELEASE() if pcm_addchan() fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 13 May 2025 22:02:53 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=dbfe79bbe5d5ebe296fbff2d101e0994d7881d0d
commit dbfe79bbe5d5ebe296fbff2d101e0994d7881d0d
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-05-13 22:02:41 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-05-13 22:02:41 +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
---
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 f6c35769e7f3..e690b53c411d 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