diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 85efa2634fd..ddf466b6f97 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -428,14 +428,13 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev) struct snddev_channel *sce, *tmp, *after; int unit = device_get_unit(d->dev); - snd_mtxlock(d->lock); - sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO); if (!sce) { - snd_mtxunlock(d->lock); return ENOMEM; } + snd_mtxlock(d->lock); + sce->channel = ch; if (SLIST_EMPTY(&d->channels)) { SLIST_INSERT_HEAD(&d->channels, sce, link);