From nobody Fri Oct 18 08:45:06 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XVJDf5RVgz5YwKB; Fri, 18 Oct 2024 08:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XVJDf304sz4mZJ; Fri, 18 Oct 2024 08:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729241106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yti4iqMXRlcEvW1n3fAqMGJw7nUj3hyWjXApbT/9CZQ=; b=MZaCwMsRh7NQ+PyOBIMTnntL8RrqJysoWvqlxFazckD252gMPRamlGkPhGpk20KPM37gy0 8Owt0+7xvVwoYmO/CXVkj/10oI4ZWSlnG0L1XWNhfjOsJtLYJ+YIXlUZ+E/SasEF2/YORT WDvPvvq5ou0NrtaVm2IghumlQjtgWwlFnRIoQkBoT18xl4ORJuo23C08cVbGbdSIKMVE+W sANtUvvnb+6hoC9Igce8pmB9i7/f3EmV2F3QvL1pecD3fN9Az22OnbWPvVUIuhXjcHmVm5 iomQzI5fPHGB7mVB6DhAgOPAu5g2dW8s9BL0WBVSx9IRss5KJWEBj89ljUibvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729241106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yti4iqMXRlcEvW1n3fAqMGJw7nUj3hyWjXApbT/9CZQ=; b=X1ah35QmITDKLNjzd8GIb5KhB5S2jPt6Sz/frg4ViVqnzYbVwnBWkHLg+h6kHfcR0OVtXs 8vbDQ7PnZCYDRYAq2jnM287KuqXsaKvrqc3tx/1STRgwMIKCpRNXKL66whBHeGkOze8wA/ eqFKp6Jlbw4EMuVU33s6cqXq6WMkn38P7dEDh9G+EEzEjWze/0fhW0ycRNmgSa0AvPUAMD VD0KW0bq0o8ilX8u2ZcEgPi06FWx+/dk28iTORLgKYpAsDmqgjZtP1FwqklWttarfQWb17 DR3844VPq+q5ejSj/+M7Kkit7HIrM5zBrc2FAksAIFA58oBJwn3ZJ13WMwy4UQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729241106; a=rsa-sha256; cv=none; b=SJdQyIau3BTBBFAJxJ+CQ90A3OxE4SONyM0/c6ZMG02aRIqHkgOxkydgeQAC27/u7CLm1A 0BKRv2pLyvQVQtthASD4YMVsGfuvuOrlNazSmT3aZQtCLFv6+fneyNFpK69hQe8y4/LehJ nIAoUxyuqtV2sMzDw2TeZq1hIjHh97dGErKhRiT6CMIbuWwWsFFLFs4/dtyMbOBXRcKwdP yLiy5kaEUyMMZChDR/OqHLoshd+orhAy4RuEt9xiCkIvtAUe00ojjjeaj2IPSeWBZeKvil ryJPXKNPejZ05vHTfgWuLMDbEzAaxI1avw/peF3e8WbGYw8CdFCT+y28zOAKCw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XVJDf2K8pzRTq; Fri, 18 Oct 2024 08:45:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49I8j6wo088398; Fri, 18 Oct 2024 08:45:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49I8j6Tb088395; Fri, 18 Oct 2024 08:45:06 GMT (envelope-from git) Date: Fri, 18 Oct 2024 08:45:06 GMT Message-Id: <202410180845.49I8j6Tb088395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 5e33eca8e8f3 - main - sound: Use M_WAITOK where possible List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e33eca8e8f359d4d48f4c50334a03748420a7da Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=5e33eca8e8f359d4d48f4c50334a03748420a7da commit 5e33eca8e8f359d4d48f4c50334a03748420a7da Author: Christos Margiolis AuthorDate: 2024-10-18 08:41:05 +0000 Commit: Christos Margiolis 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;