diff options
Diffstat (limited to 'include/asm-i386/dma-mapping.h')
-rw-r--r-- | include/asm-i386/dma-mapping.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h index 6c37a9ab8d60..9cf20cacf76e 100644 --- a/include/asm-i386/dma-mapping.h +++ b/include/asm-i386/dma-mapping.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <asm/cache.h> | 6 | #include <asm/cache.h> |
7 | #include <asm/io.h> | 7 | #include <asm/io.h> |
8 | #include <asm/scatterlist.h> | 8 | #include <asm/scatterlist.h> |
9 | #include <asm/bug.h> | ||
9 | 10 | ||
10 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) | 11 | #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) |
11 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) | 12 | #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) |
@@ -20,7 +21,9 @@ static inline dma_addr_t | |||
20 | dma_map_single(struct device *dev, void *ptr, size_t size, | 21 | dma_map_single(struct device *dev, void *ptr, size_t size, |
21 | enum dma_data_direction direction) | 22 | enum dma_data_direction direction) |
22 | { | 23 | { |
23 | BUG_ON(direction == DMA_NONE); | 24 | if (direction == DMA_NONE) |
25 | BUG(); | ||
26 | WARN_ON(size == 0); | ||
24 | flush_write_buffers(); | 27 | flush_write_buffers(); |
25 | return virt_to_phys(ptr); | 28 | return virt_to_phys(ptr); |
26 | } | 29 | } |
@@ -29,7 +32,8 @@ static inline void | |||
29 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | 32 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, |
30 | enum dma_data_direction direction) | 33 | enum dma_data_direction direction) |
31 | { | 34 | { |
32 | BUG_ON(direction == DMA_NONE); | 35 | if (direction == DMA_NONE) |
36 | BUG(); | ||
33 | } | 37 | } |
34 | 38 | ||
35 | static inline int | 39 | static inline int |
@@ -38,7 +42,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
38 | { | 42 | { |
39 | int i; | 43 | int i; |
40 | 44 | ||
41 | BUG_ON(direction == DMA_NONE); | 45 | if (direction == DMA_NONE) |
46 | BUG(); | ||
47 | WARN_ON(nents == 0 || sg[0].length == 0); | ||
42 | 48 | ||
43 | for (i = 0; i < nents; i++ ) { | 49 | for (i = 0; i < nents; i++ ) { |
44 | BUG_ON(!sg[i].page); | 50 | BUG_ON(!sg[i].page); |