aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-bcmring/dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-bcmring/dma.c')
-rw-r--r--arch/arm/mach-bcmring/dma.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/arm/mach-bcmring/dma.c b/arch/arm/mach-bcmring/dma.c
index 7b20fccb9d4e..29c0a911df26 100644
--- a/arch/arm/mach-bcmring/dma.c
+++ b/arch/arm/mach-bcmring/dma.c
@@ -28,6 +28,7 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/irqreturn.h> 29#include <linux/irqreturn.h>
30#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
31#include <linux/slab.h>
31 32
32#include <mach/timer.h> 33#include <mach/timer.h>
33 34
@@ -2220,11 +2221,15 @@ EXPORT_SYMBOL(dma_map_create_descriptor_ring);
2220int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */ 2221int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
2221 int dirtied /* non-zero if any of the pages were modified */ 2222 int dirtied /* non-zero if any of the pages were modified */
2222 ) { 2223 ) {
2224
2225 int rc = 0;
2223 int regionIdx; 2226 int regionIdx;
2224 int segmentIdx; 2227 int segmentIdx;
2225 DMA_Region_t *region; 2228 DMA_Region_t *region;
2226 DMA_Segment_t *segment; 2229 DMA_Segment_t *segment;
2227 2230
2231 down(&memMap->lock);
2232
2228 for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) { 2233 for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) {
2229 region = &memMap->region[regionIdx]; 2234 region = &memMap->region[regionIdx];
2230 2235
@@ -2238,7 +2243,8 @@ int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
2238 printk(KERN_ERR 2243 printk(KERN_ERR
2239 "%s: vmalloc'd pages are not yet supported\n", 2244 "%s: vmalloc'd pages are not yet supported\n",
2240 __func__); 2245 __func__);
2241 return -EINVAL; 2246 rc = -EINVAL;
2247 goto out;
2242 } 2248 }
2243 2249
2244 case DMA_MEM_TYPE_KMALLOC: 2250 case DMA_MEM_TYPE_KMALLOC:
@@ -2275,7 +2281,8 @@ int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
2275 printk(KERN_ERR 2281 printk(KERN_ERR
2276 "%s: Unsupported memory type: %d\n", 2282 "%s: Unsupported memory type: %d\n",
2277 __func__, region->memType); 2283 __func__, region->memType);
2278 return -EINVAL; 2284 rc = -EINVAL;
2285 goto out;
2279 } 2286 }
2280 } 2287 }
2281 2288
@@ -2313,9 +2320,10 @@ int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
2313 memMap->numRegionsUsed = 0; 2320 memMap->numRegionsUsed = 0;
2314 memMap->inUse = 0; 2321 memMap->inUse = 0;
2315 2322
2323out:
2316 up(&memMap->lock); 2324 up(&memMap->lock);
2317 2325
2318 return 0; 2326 return rc;
2319} 2327}
2320 2328
2321EXPORT_SYMBOL(dma_unmap); 2329EXPORT_SYMBOL(dma_unmap);