From c7f73b67b598ddcc9112e1bd25b41f9b3f7a867a Mon Sep 17 00:00:00 2001 From: Jake Burkholder Date: Tue, 1 Oct 2002 00:17:39 +0000 Subject: [PATCH] Use M_NOWAIT instead of M_WAITOK when allocating dmamaps; the allocations functions may be called from a device strategy routine when sleeping is bad. Submitted by: phk Reviewed by: tmm --- sys/sparc64/sparc64/bus_machdep.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/sparc64/sparc64/bus_machdep.c b/sys/sparc64/sparc64/bus_machdep.c index 897e04d36b6..13979921a6d 100644 --- a/sys/sparc64/sparc64/bus_machdep.c +++ b/sys/sparc64/sparc64/bus_machdep.c @@ -268,9 +268,12 @@ nexus_dmamap_create(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, int flags, { /* Not much to do...? */ - *mapp = malloc(sizeof(**mapp), M_DEVBUF, M_WAITOK | M_ZERO); - ddmat->map_count++; - return (0); + *mapp = malloc(sizeof(**mapp), M_DEVBUF, M_NOWAIT | M_ZERO); + if (*mapp != NULL) { + ddmat->map_count++; + return (0); + } else + return (ENOMEM); } /* @@ -422,7 +425,7 @@ int sparc64_dmamem_alloc_map(bus_dma_tag_t dmat, bus_dmamap_t *mapp) { - *mapp = malloc(sizeof(**mapp), M_DEVBUF, M_WAITOK | M_ZERO); + *mapp = malloc(sizeof(**mapp), M_DEVBUF, M_NOWAIT | M_ZERO); if (*mapp == NULL) return (ENOMEM);