git: 5fc710ae2d78 - stable/14 - sound: Call vchan_destroy() on vchan_create() failure

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 04 Mar 2025 15:46:55 UTC
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=5fc710ae2d78d0f8625513b04d131011bde1f7c8

commit 5fc710ae2d78d0f8625513b04d131011bde1f7c8
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-02-25 11:43:19 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-03-04 15:46:05 +0000

    sound: Call vchan_destroy() on vchan_create() failure
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    dev_submerge.ch
    Differential Revision:  https://reviews.freebsd.org/D48183
    
    (cherry picked from commit 2546ab1b3632a9ebfe88d9d5dc55700e653bff5d)
---
 sys/dev/sound/pcm/vchan.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c
index ea8a50b316fe..4ee7e01066d3 100644
--- a/sys/dev/sound/pcm/vchan.c
+++ b/sys/dev/sound/pcm/vchan.c
@@ -811,11 +811,8 @@ vchan_create(struct pcm_channel *parent)
 	return (ret);
 
 fail:
-	CHN_REMOVE(parent, ch, children);
-	parent->flags &= ~CHN_F_HAS_VCHAN;
-	CHN_UNLOCK(parent);
-	chn_kill(ch);
-	CHN_LOCK(parent);
+	CHN_LOCK(ch);
+	vchan_destroy(ch);
 
 	return (ret);
 }