mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-28 08:02:54 +00:00
sound: Use M_WAITOK where possible
These malloc(9) calls are in contexts where sleeping is permitted. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch, zlei, markj, emaste Differential Revision: https://reviews.freebsd.org/D46845
This commit is contained in:
parent
3cc01caa26
commit
5e33eca8e8
@ -1296,12 +1296,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls,
|
||||
*/
|
||||
if (c->direction == PCMDIR_PLAY) {
|
||||
bs->sl = sndbuf_getmaxsize(bs);
|
||||
bs->shadbuf = malloc(bs->sl, M_DEVBUF, M_NOWAIT);
|
||||
if (bs->shadbuf == NULL) {
|
||||
device_printf(d->dev, "%s(): failed to create shadow "
|
||||
"buffer\n", __func__);
|
||||
goto fail;
|
||||
}
|
||||
bs->shadbuf = malloc(bs->sl, M_DEVBUF, M_WAITOK);
|
||||
}
|
||||
|
||||
PCM_LOCK(d);
|
||||
|
@ -62,11 +62,7 @@ feeder_register_root(void *p)
|
||||
KASSERT(fc->desc == NULL, ("first feeder not root: %s", fc->name));
|
||||
|
||||
SLIST_INIT(&feedertab);
|
||||
fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO);
|
||||
if (fte == NULL) {
|
||||
printf("can't allocate memory for root feeder: %s\n", fc->name);
|
||||
return;
|
||||
}
|
||||
fte = malloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO);
|
||||
fte->feederclass = fc;
|
||||
fte->desc = NULL;
|
||||
fte->idx = feedercnt;
|
||||
@ -92,13 +88,7 @@ feeder_register(void *p)
|
||||
*/
|
||||
i = 0;
|
||||
while ((feedercnt < MAXFEEDERS) && (fc->desc[i].type > 0)) {
|
||||
fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO);
|
||||
if (fte == NULL) {
|
||||
printf("can't allocate memory for feeder '%s', "
|
||||
"%x -> %x\n",
|
||||
fc->name, fc->desc[i].in, fc->desc[i].out);
|
||||
return;
|
||||
}
|
||||
fte = malloc(sizeof(*fte), M_FEEDER, M_WAITOK | M_ZERO);
|
||||
fte->feederclass = fc;
|
||||
fte->desc = &fc->desc[i];
|
||||
fte->idx = feedercnt;
|
||||
|
Loading…
Reference in New Issue
Block a user