diff options
author | jake <jake@FreeBSD.org> | 2002-10-01 00:17:39 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2002-10-01 00:17:39 +0000 |
commit | ce6cadf021344067745991e2e5d27a1814ed842f (patch) | |
tree | 4d52f69f1ad0cb32349bbbf0cfdd955dcbc23282 | |
parent | 8ff315066069409e70ce58c41fd244540234a152 (diff) | |
download | FreeBSD-src-ce6cadf021344067745991e2e5d27a1814ed842f.zip FreeBSD-src-ce6cadf021344067745991e2e5d27a1814ed842f.tar.gz |
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
-rw-r--r-- | sys/sparc64/sparc64/bus_machdep.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/sparc64/sparc64/bus_machdep.c b/sys/sparc64/sparc64/bus_machdep.c index 897e04d..1397992 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); |