git: fa75c1cc2426 - main - mwl: return ENOMEM when rx buffer allocation fails

From: Kevin Lo <kevlo_at_FreeBSD.org>
Date: Mon, 15 Jun 2026 01:47:09 UTC
The branch main has been updated by kevlo:

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

commit fa75c1cc242665d123ef5bf2f4ced2e076b35450
Author:     Kevin Lo <kevlo@FreeBSD.org>
AuthorDate: 2026-06-15 01:43:57 +0000
Commit:     Kevin Lo <kevlo@FreeBSD.org>
CommitDate: 2026-06-15 01:43:57 +0000

    mwl: return ENOMEM when rx buffer allocation fails
    
    The malloc() failure path returned error, which is 0 at this point,
    so callers would treat the allocation failure as success.
    Return ENOMEM instead to correctly propagate the out-of-memory condition.
    
    Reviewed by:    adrian
    Differential Revision:  https://reviews.freebsd.org/D42282
---
 sys/dev/mwl/if_mwl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c
index 87e2679778db..3dc44ba20ee4 100644
--- a/sys/dev/mwl/if_mwl.c
+++ b/sys/dev/mwl/if_mwl.c
@@ -2165,7 +2165,7 @@ mwl_rxdma_setup(struct mwl_softc *sc)
 	bf = malloc(bsize, M_MWLDEV, M_NOWAIT | M_ZERO);
 	if (bf == NULL) {
 		device_printf(sc->sc_dev, "malloc of %u rx buffers failed\n", bsize);
-		return error;
+		return ENOMEM;
 	}
 	sc->sc_rxdma.dd_bufptr = bf;