git: 201d2e45f51f - stable/14 - p9fs: use M_WAITOK where appropriate

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Fri, 04 Jul 2025 13:28:48 UTC
The branch stable/14 has been updated by arrowd:

URL: https://cgit.FreeBSD.org/src/commit/?id=201d2e45f51fee2b1438bcc0a53a51bd6416ea73

commit 201d2e45f51fee2b1438bcc0a53a51bd6416ea73
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-06-24 20:10:00 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2025-07-04 13:28:06 +0000

    p9fs: use M_WAITOK where appropriate
    
    device_attach routines are allowed to sleep, and this routine already
    has other M_WAITOK allocations.
    
    Reported by:    markj
    Reviewed by:    markj
    Fixes: 1efd69f933b6 ("p9fs: move NULL check immediately after alloc...")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D45721
    
    (cherry picked from commit e6b88237c6c33fe2f66cad9836858b877900871a)
---
 sys/dev/virtio/p9fs/virtio_p9fs.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c
index 1c076e353bbc..e87659da2732 100644
--- a/sys/dev/virtio/p9fs/virtio_p9fs.c
+++ b/sys/dev/virtio/p9fs/virtio_p9fs.c
@@ -331,12 +331,7 @@ vt9p_attach(device_t dev)
 	/* Initialize the condition variable */
 	cv_init(&chan->submit_cv, "Conditional variable for submit queue" );
 	chan->max_nsegs = MAX_SUPPORTED_SGS;
-	chan->vt9p_sglist = sglist_alloc(chan->max_nsegs, M_NOWAIT);
-	if (chan->vt9p_sglist == NULL) {
-		error = ENOMEM;
-		P9_DEBUG(ERROR, "%s: Cannot allocate sglist\n", __func__);
-		goto out;
-	}
+	chan->vt9p_sglist = sglist_alloc(chan->max_nsegs, M_WAITOK);
 
 	/* Negotiate the features from the host */
 	virtio_set_feature_desc(dev, virtio_9p_feature_desc);