diff options
-rw-r--r-- | arch/arm/common/dmabounce.c | 6 | ||||
-rw-r--r-- | arch/arm/include/asm/dma-mapping.h | 4 | ||||
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 595ecd290ebf..210ad1bef7e5 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
@@ -254,7 +254,7 @@ static inline dma_addr_t map_single(struct device *dev, void *ptr, size_t size, | |||
254 | if (buf == NULL) { | 254 | if (buf == NULL) { |
255 | dev_err(dev, "%s: unable to map unsafe buffer %p!\n", | 255 | dev_err(dev, "%s: unable to map unsafe buffer %p!\n", |
256 | __func__, ptr); | 256 | __func__, ptr); |
257 | return ~0; | 257 | return DMA_ERROR_CODE; |
258 | } | 258 | } |
259 | 259 | ||
260 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", | 260 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", |
@@ -320,7 +320,7 @@ dma_addr_t __dma_map_page(struct device *dev, struct page *page, | |||
320 | 320 | ||
321 | ret = needs_bounce(dev, dma_addr, size); | 321 | ret = needs_bounce(dev, dma_addr, size); |
322 | if (ret < 0) | 322 | if (ret < 0) |
323 | return ~0; | 323 | return DMA_ERROR_CODE; |
324 | 324 | ||
325 | if (ret == 0) { | 325 | if (ret == 0) { |
326 | __dma_page_cpu_to_dev(page, offset, size, dir); | 326 | __dma_page_cpu_to_dev(page, offset, size, dir); |
@@ -329,7 +329,7 @@ dma_addr_t __dma_map_page(struct device *dev, struct page *page, | |||
329 | 329 | ||
330 | if (PageHighMem(page)) { | 330 | if (PageHighMem(page)) { |
331 | dev_err(dev, "DMA buffer bouncing of HIGHMEM pages is not supported\n"); | 331 | dev_err(dev, "DMA buffer bouncing of HIGHMEM pages is not supported\n"); |
332 | return ~0; | 332 | return DMA_ERROR_CODE; |
333 | } | 333 | } |
334 | 334 | ||
335 | return map_single(dev, page_address(page) + offset, size, dir); | 335 | return map_single(dev, page_address(page) + offset, size, dir); |
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index cb3b7c981c4b..6a838da03c5b 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <asm-generic/dma-coherent.h> | 10 | #include <asm-generic/dma-coherent.h> |
11 | #include <asm/memory.h> | 11 | #include <asm/memory.h> |
12 | 12 | ||
13 | #define DMA_ERROR_CODE (~0) | ||
14 | |||
13 | #ifdef __arch_page_to_dma | 15 | #ifdef __arch_page_to_dma |
14 | #error Please update to __arch_pfn_to_dma | 16 | #error Please update to __arch_pfn_to_dma |
15 | #endif | 17 | #endif |
@@ -123,7 +125,7 @@ extern int dma_set_mask(struct device *, u64); | |||
123 | */ | 125 | */ |
124 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 126 | static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
125 | { | 127 | { |
126 | return dma_addr == ~0; | 128 | return dma_addr == DMA_ERROR_CODE; |
127 | } | 129 | } |
128 | 130 | ||
129 | /* | 131 | /* |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 322c70a0190b..e4ac5fc86b0a 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -342,7 +342,7 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, | |||
342 | */ | 342 | */ |
343 | gfp &= ~(__GFP_COMP); | 343 | gfp &= ~(__GFP_COMP); |
344 | 344 | ||
345 | *handle = ~0; | 345 | *handle = DMA_ERROR_CODE; |
346 | size = PAGE_ALIGN(size); | 346 | size = PAGE_ALIGN(size); |
347 | 347 | ||
348 | page = __dma_alloc_buffer(dev, size, gfp); | 348 | page = __dma_alloc_buffer(dev, size, gfp); |