Spring cleanup on irrelevant NULL checking over M_WAITOK allocations.

This commit is contained in:
Ariff Abdullah 2007-03-15 18:19:01 +00:00
parent 12828031ac
commit 4beb77e673
6 changed files with 3 additions and 47 deletions

View File

@ -819,13 +819,6 @@ ac97_create(device_t dev, void *devinfo, kobj_class_t cls)
snprintf(codec->name, AC97_NAMELEN, "%s:ac97", device_get_nameunit(dev));
codec->lock = snd_mtxcreate(codec->name, "ac97 codec");
codec->methods = kobj_create(cls, M_AC97, M_WAITOK | M_ZERO);
if (codec->methods == NULL) {
snd_mtxlock(codec->lock);
snd_mtxfree(codec->lock);
free(codec, M_AC97);
return NULL;
}
codec->dev = dev;
codec->devinfo = devinfo;
codec->flags = 0;

View File

@ -196,25 +196,8 @@ sndbuf_remalloc(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz)
chn_unlock(b->channel);
buf = malloc(bufsize, M_DEVBUF, M_WAITOK);
if (buf == NULL) {
ret = ENOMEM;
goto out;
}
tmpbuf = malloc(bufsize, M_DEVBUF, M_WAITOK);
if (tmpbuf == NULL) {
free(buf, M_DEVBUF);
ret = ENOMEM;
goto out;
}
shadbuf = malloc(bufsize, M_DEVBUF, M_WAITOK);
if (shadbuf == NULL) {
free(buf, M_DEVBUF);
free(tmpbuf, M_DEVBUF);
ret = ENOMEM;
goto out;
}
chn_lock(b->channel);
@ -241,7 +224,7 @@ sndbuf_remalloc(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz)
free(f3, M_DEVBUF);
ret = 0;
out:
chn_lock(b->channel);
return ret;
}

View File

@ -137,7 +137,7 @@ fkchan_setup(device_t dev)
struct snddev_info *d = device_get_softc(dev);
struct pcm_channel *c;
c = malloc(sizeof(*c), M_DEVBUF, M_WAITOK);
c = malloc(sizeof(*c), M_DEVBUF, M_WAITOK | M_ZERO);
c->methods = kobj_create(&fkchan_class, M_DEVBUF, M_WAITOK);
c->parentsnddev = d;
/*

View File

@ -225,10 +225,7 @@ sndstat_register(device_t dev, char *str, sndstat_handler handler)
unit = -1;
}
ent = malloc(sizeof *ent, M_DEVBUF, M_ZERO | M_WAITOK);
if (!ent)
return ENOSPC;
ent = malloc(sizeof *ent, M_DEVBUF, M_WAITOK | M_ZERO);
ent->dev = dev;
ent->str = str;
ent->type = type;

View File

@ -447,15 +447,7 @@ pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t c
}
ch = malloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO);
if (!ch)
return NULL;
ch->methods = kobj_create(cls, M_DEVBUF, M_WAITOK);
if (!ch->methods) {
free(ch, M_DEVBUF);
return NULL;
}
snd_mtxlock(d->lock);
ch->num = 0;
@ -561,9 +553,6 @@ pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch)
*/
sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO);
if (!sce) {
return ENOMEM;
}
snd_mtxlock(d->lock);
sce->channel = ch;

View File

@ -318,8 +318,6 @@ vchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c,
KASSERT(dir == PCMDIR_PLAY, ("vchan_init: bad direction"));
ch = malloc(sizeof(*ch), M_DEVBUF, M_WAITOK | M_ZERO);
if (!ch)
return NULL;
ch->parent = parent;
ch->channel = c;
ch->fmt = AFMT_U8;
@ -675,10 +673,6 @@ vchan_create(struct pcm_channel *parent)
CHN_UNLOCK(parent);
pce = malloc(sizeof(*pce), M_DEVBUF, M_WAITOK | M_ZERO);
if (!pce) {
CHN_LOCK(parent);
return ENOMEM;
}
/* create a new playback channel */
child = pcm_chn_create(d, parent, &vchan_class, PCMDIR_VIRTUAL, parent);