Skip to content

Commit

Permalink
sound: Convert pcm_chn_add() to void
Browse files Browse the repository at this point in the history
It always returns 0.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D44998
  • Loading branch information
christosmarg committed May 6, 2024
1 parent 76f95ba commit 139bcec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
14 changes: 3 additions & 11 deletions sys/dev/sound/pcm/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -405,8 +405,6 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch)
default:
__assert_unreachable();
}

return (0);
}

int
Expand Down Expand Up @@ -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);

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sys/dev/sound/pcm/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 2 additions & 6 deletions sys/dev/sound/pcm/vchan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
/*
Expand All @@ -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;
Expand Down

0 comments on commit 139bcec

Please sign in to comment.