View | Details | Raw Unified | Return to bug 28084
Collapse All | Expand All

(-)pcm/sound.c (-3 / +1 lines)
Lines 345-354 Link Here
345
    	int unit = device_get_unit(d->dev);
345
    	int unit = device_get_unit(d->dev);
346
346
347
	sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO);
347
	sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO);
348
	if (!sce) {
348
	if (!sce)
349
		free(ch, M_DEVBUF);
350
		return ENOMEM;
349
		return ENOMEM;
351
	}
352
350
353
	snd_mtxlock(d->lock);
351
	snd_mtxlock(d->lock);
354
	sce->channel = ch;
352
	sce->channel = ch;
(-)pcm/vchan.c (-2 / +26 lines)
Lines 331-338 Link Here
331
{
331
{
332
	struct snddev_info *d;
332
	struct snddev_info *d;
333
    	struct snddev_channel *sce;
333
    	struct snddev_channel *sce;
334
	struct pcm_channel *c;
334
	struct pcm_channel *c, **arec, **aplay;
335
	int err, newcnt, cnt;
335
	int err, newcnt, cnt, sz;
336
336
337
	d = oidp->oid_arg1;
337
	d = oidp->oid_arg1;
338
338
Lines 373-384 Link Here
373
			snd_mtxunlock(d->lock);
373
			snd_mtxunlock(d->lock);
374
			return EBUSY;
374
			return EBUSY;
375
addok:
375
addok:
376
			if (d->maxchans < (d->chancount + newcnt - cnt)) {
377
				sz = (d->chancount + newcnt - cnt) *
378
					sizeof(struct pcm_channel *);
379
				aplay = (struct pcm_channel **)
380
					malloc(sz, M_DEVBUF, M_WAITOK | M_ZERO);
381
				arec = (struct pcm_channel **)
382
					malloc(sz, M_DEVBUF, M_WAITOK | M_ZERO);
383
                		if (!arec || !aplay) {
384
					if (aplay) free(aplay, M_DEVBUF);	
385
					if (arec) free(arec, M_DEVBUF);	
386
					return ENOMEM;
387
				}
388
				sz = d->maxchans * sizeof(struct pcm_channel *);
389
		                bcopy(d->arec, arec, sz);
390
		                bcopy(d->aplay, aplay, sz);
391
				free(d->arec, M_DEVBUF);
392
				free(d->aplay, M_DEVBUF);
393
				d->arec   = arec;
394
				d->aplay  = aplay;
395
				d->maxchans = d->chancount + newcnt - cnt;
396
			}
376
			c->flags |= CHN_F_BUSY;
397
			c->flags |= CHN_F_BUSY;
377
			while (err == 0 && newcnt > cnt) {
398
			while (err == 0 && newcnt > cnt) {
378
				err = vchan_create(c);
399
				err = vchan_create(c);
379
				if (err == 0)
400
				if (err == 0)
380
					cnt++;
401
					cnt++;
381
			}
402
			}
403
			/* Clear parent busy flag if no children were created */
404
			if (SLIST_EMPTY(&c->children))
405
				c->flags &= ~CHN_F_BUSY;
382
		} else if (newcnt < cnt) {
406
		} else if (newcnt < cnt) {
383
			while (err == 0 && newcnt < cnt) {
407
			while (err == 0 && newcnt < cnt) {
384
				SLIST_FOREACH(sce, &d->channels, link) {
408
				SLIST_FOREACH(sce, &d->channels, link) {

Return to bug 28084