From 36e6513df5e701274365bbf3f3e1c4831f609efb Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 15 Jul 2008 03:34:49 +0000 Subject: [PATCH] Update bus_dmamem_alloc()'s first call to malloc() such that M_WAITOK is specified when appropriate. Reviewed by: scottl --- sys/amd64/amd64/busdma_machdep.c | 8 ++++---- sys/i386/i386/busdma_machdep.c | 6 +++--- sys/ia64/ia64/busdma_machdep.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/amd64/amd64/busdma_machdep.c b/sys/amd64/amd64/busdma_machdep.c index c9475d525c97..f68e90b4e50a 100644 --- a/sys/amd64/amd64/busdma_machdep.c +++ b/sys/amd64/amd64/busdma_machdep.c @@ -480,8 +480,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, mflags = M_NOWAIT; else mflags = M_WAITOK; - if (flags & BUS_DMA_ZERO) - mflags |= M_ZERO; /* If we succeed, no mapping/bouncing will be required */ *mapp = NULL; @@ -489,13 +487,15 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if (dmat->segments == NULL) { dmat->segments = (bus_dma_segment_t *)malloc( sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); + mflags); if (dmat->segments == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); } } + if (flags & BUS_DMA_ZERO) + mflags |= M_ZERO; /* * XXX: @@ -531,7 +531,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, pmap_change_attr((vm_offset_t)*vaddr, dmat->maxsize, PAT_UNCACHEABLE); CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", - __func__, dmat, dmat->flags, ENOMEM); + __func__, dmat, dmat->flags, 0); return (0); } diff --git a/sys/i386/i386/busdma_machdep.c b/sys/i386/i386/busdma_machdep.c index fc3966e15b8a..7069d2d5ac78 100644 --- a/sys/i386/i386/busdma_machdep.c +++ b/sys/i386/i386/busdma_machdep.c @@ -488,8 +488,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, mflags = M_NOWAIT; else mflags = M_WAITOK; - if (flags & BUS_DMA_ZERO) - mflags |= M_ZERO; /* If we succeed, no mapping/bouncing will be required */ *mapp = NULL; @@ -497,13 +495,15 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if (dmat->segments == NULL) { dmat->segments = (bus_dma_segment_t *)malloc( sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); + mflags); if (dmat->segments == NULL) { CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", __func__, dmat, dmat->flags, ENOMEM); return (ENOMEM); } } + if (flags & BUS_DMA_ZERO) + mflags |= M_ZERO; /* * XXX: diff --git a/sys/ia64/ia64/busdma_machdep.c b/sys/ia64/ia64/busdma_machdep.c index 8dd4a9bcf8bd..6cc2988bc608 100644 --- a/sys/ia64/ia64/busdma_machdep.c +++ b/sys/ia64/ia64/busdma_machdep.c @@ -416,8 +416,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, mflags = M_NOWAIT; else mflags = M_WAITOK; - if (flags & BUS_DMA_ZERO) - mflags |= M_ZERO; /* If we succeed, no mapping/bouncing will be required */ *mapp = NULL; @@ -425,10 +423,12 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, if (dmat->segments == NULL) { dmat->segments = (bus_dma_segment_t *)malloc( sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); + mflags); if (dmat->segments == NULL) return (ENOMEM); } + if (flags & BUS_DMA_ZERO) + mflags |= M_ZERO; /* * XXX: