git: 5e33eca8e8f3 - main - sound: Use M_WAITOK where possible
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Oct 2024 08:45:06 UTC
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=5e33eca8e8f359d4d48f4c50334a03748420a7da commit 5e33eca8e8f359d4d48f4c50334a03748420a7da Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2024-10-18 08:41:05 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2024-10-18 08:41:05 +0000 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 --- sys/dev/sound/pcm/channel.c | 7 +------ sys/dev/sound/pcm/feeder.c | 14 ++------------ 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 1e68be161322..6b8f00f9aa83 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -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); diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index c6f93ac54036..2b9599859102 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -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;