From nobody Sun Oct 20 11:21:45 2024 X-Original-To: dev-commits-src-all@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 4XWbcT62H4z5YvRN; Sun, 20 Oct 2024 11:21:45 +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 4XWbcT3qpXz4XHT; Sun, 20 Oct 2024 11:21:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729423305; 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=mOIyjnB10iw2jd0YWHkOmHbv+qwO0jCI3zqBKDTYBBI=; b=Nwhx2aKOtVC2ZCTsWnjYDji4M+hkPaYP6ItEL/K6QoH4mAAJSM04PAP+vY/w7Egp1VdrF/ BQKyV2m7l3EC3pYlwtVRAO9GfQzBfxo2ArSjcREEOGEeA5XW+/t4BCaRuCDN69e1wwL0sM 7Eei1X7eL/5mZkCGB4E4KLg8EgXP8kkxE9UYcnN22SM82DCfc+y7eFZOAHMI4DiicekLxJ 3A/dLi4PrUbwQCtyHOd132zWdVqW6lbwKAy0T8T1GLRij+ucJWbr1Xf8ElfUt66KrgcE87 I0GpXuONERwN4M8zCjPTq6B5FzLDT/K9WmTs3fVWhbldUNL2wZOSGWagt6GVPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729423305; 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=mOIyjnB10iw2jd0YWHkOmHbv+qwO0jCI3zqBKDTYBBI=; b=NEf3K4AmFXYvS6UTfb60zA3Jx9TFYpouaL7AmxoZDfumHYDKG6JYYzfyLYEvaMV0DxiDBz ygqlsCII70XG3WKoX8L9c5hbOCdmiIE0mtk4p5NXqB0lXWW4ge+aads6ILbwXc8ni9mN+d 6OQ/NCXsT/qtFSwHBmc1Km4enOgvyodYHotdCYBtXa2++7fPCJtkeuq0ZBwL8sXVawpbNL EoNKWJohTHm/jaKortg1Ksq+UKJFBwmp+kQSoTTMr5DXPtOWqfJDcgF9mts6WWRG/vK10G Nyx1fqLiuWxk2PYtpFArRPyDsbRbTtE7rlBM0A3MAWCrrGQLygjy1Ret2TxYtg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729423305; a=rsa-sha256; cv=none; b=DJ1ToTctMO3Xik4qMxUM1hPBp5qP0uAr+QSs5zqVQaCcIf5uRCCWcKLadtzw3vFRLsyG1/ 1DrO1+7MaIBHEXhIZPfeL9T/WPdUvLaY158QPMd5PfRBnjw5cW29/udtDwT9gOmA3zh1SE MY8JrgMXh7Tusqw6GbLU6uRB+iKBx2AL1HjUuFy3VjWoLDPV6TpDtnd9vtVQ9xoiFfZ3rq 8GQ951Ss3n1xYX1MSC3VV9JzATpalC9BH3V0Vbu7mRh9Aj5S/wBQ+CbCGkCNVnJDwskVZ0 XUHup9n7+eSreKstpkRWgA/7ByJorfGTEeCMtFaFfRgelQRw7sk+rS2Lg/gPQg== 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 4XWbcT32zGz108V; Sun, 20 Oct 2024 11:21:45 +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 49KBLjXF063178; Sun, 20 Oct 2024 11:21:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49KBLjXr063175; Sun, 20 Oct 2024 11:21:45 GMT (envelope-from git) Date: Sun, 20 Oct 2024 11:21:45 GMT Message-Id: <202410201121.49KBLjXr063175@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: 28dc9f54efa9 - stable/14 - sound: Use M_WAITOK where possible List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 28dc9f54efa94c3a17b7cfd98c7a51d42e57893a Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=28dc9f54efa94c3a17b7cfd98c7a51d42e57893a commit 28dc9f54efa94c3a17b7cfd98c7a51d42e57893a Author: Christos Margiolis AuthorDate: 2024-10-18 08:41:05 +0000 Commit: Christos Margiolis CommitDate: 2024-10-20 11:21: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 (cherry picked from commit 5e33eca8e8f359d4d48f4c50334a03748420a7da) --- 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;