git: e6b88237c6c3 - main - p9fs: use M_WAITOK where appropriate

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 25 Jun 2024 02:02:41 UTC
The branch main has been updated by emaste:

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

commit e6b88237c6c33fe2f66cad9836858b877900871a
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-06-24 20:10:00 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-06-25 02:02:13 +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
---
 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 811faff6cd93..aa174d3bd5ba 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);