The branch stable/14 has been updated by christos:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2c53a4bbcb17bbe3beddb2b56cd18d1fd3045df0

commit 2c53a4bbcb17bbe3beddb2b56cd18d1fd3045df0
Author:     Christos Margiolis <[email protected]>
AuthorDate: 2024-05-06 18:27:18 +0000
Commit:     Christos Margiolis <[email protected]>
CommitDate: 2024-05-17 19:30:34 +0000

    sound: Convert pcm_chn_add() to void
    
    It always returns 0.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    markj, emaste
    Differential Revision:  https://reviews.freebsd.org/D44998
    
    (cherry picked from commit 139bcec852cf2786ca839ca0bddbb2b78a23d6fa)
---
 sys/dev/sound/pcm/sound.c | 14 +++-----------
 sys/dev/sound/pcm/sound.h |  2 +-
 sys/dev/sound/pcm/vchan.c |  8 ++------
 3 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 2787c0ee126d..9b4de948eac4 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -379,7 +379,7 @@ SYSCTL_PROC(_hw_snd, OID_AUTO, maxautovchans,
     sysctl_hw_snd_maxautovchans, "I",
     "maximum virtual channel");
 
-int
+void
 pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch)
 {
        PCM_BUSYASSERT(d);
@@ -405,8 +405,6 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch)
        default:
                __assert_unreachable();
        }
-
-       return (0);
 }
 
 int
@@ -454,7 +452,6 @@ 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;
 
        PCM_BUSYASSERT(d);
 
@@ -467,15 +464,10 @@ pcm_addchan(device_t dev, int dir, kobj_class_t cls, void 
*devinfo)
                return (ENODEV);
        }
 
-       err = pcm_chn_add(d, ch);
+       pcm_chn_add(d, ch);
        PCM_UNLOCK(d);
-       if (err) {
-               device_printf(d->dev, "pcm_chn_add(%s) failed, err=%d\n",
-                   ch->name, err);
-               chn_kill(ch);
-       }
 
-       return (err);
+       return (0);
 }
 
 static void
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index 09e739ea5c20..6c9f4c8f18b2 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -297,7 +297,7 @@ int pcm_setvchans(struct snddev_info *d, int direction, int 
newcnt, int num);
 int pcm_chnalloc(struct snddev_info *d, struct pcm_channel **ch, int direction,
     pid_t pid, char *comm);
 
-int pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch);
+void pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch);
 int pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch);
 
 int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo);
diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c
index ccac08891220..1a21b7049b77 100644
--- a/sys/dev/sound/pcm/vchan.c
+++ b/sys/dev/sound/pcm/vchan.c
@@ -706,13 +706,8 @@ vchan_create(struct pcm_channel *parent, int num)
        }
 
        /* add us to our grandparent's channel list */
-       ret = pcm_chn_add(d, ch);
+       pcm_chn_add(d, ch);
        PCM_UNLOCK(d);
-       if (ret != 0) {
-               chn_kill(ch);
-               CHN_LOCK(parent);
-               return (ret);
-       }
 
        CHN_LOCK(parent);
        /*
@@ -727,6 +722,7 @@ vchan_create(struct pcm_channel *parent, int num)
 
        parent->flags |= CHN_F_HAS_VCHAN;
 
+       ret = 0;
        parent_caps = chn_getcaps(parent);
        if (parent_caps == NULL)
                ret = EINVAL;

Reply via email to