ARM: 6024/1: bcmring: fix missing down on semaphore in dma.c

Added missing down on the memMap->lock semaphore. Also fixed a return
statement so that we always exit with an up (i.e. early exit via return
is not allowed)

Signed-off-by: Leo Hao Chen <leochen@broadcom.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Leo Chen and committed by Russell King 76708ab8 0fdf8675

+10 -3
+10 -3
arch/arm/mach-bcmring/dma.c
··· 2221 2221 int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */ 2222 2222 int dirtied /* non-zero if any of the pages were modified */ 2223 2223 ) { 2224 + 2225 + int rc = 0; 2224 2226 int regionIdx; 2225 2227 int segmentIdx; 2226 2228 DMA_Region_t *region; 2227 2229 DMA_Segment_t *segment; 2230 + 2231 + down(&memMap->lock); 2228 2232 2229 2233 for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) { 2230 2234 region = &memMap->region[regionIdx]; ··· 2243 2239 printk(KERN_ERR 2244 2240 "%s: vmalloc'd pages are not yet supported\n", 2245 2241 __func__); 2246 - return -EINVAL; 2242 + rc = -EINVAL; 2243 + goto out; 2247 2244 } 2248 2245 2249 2246 case DMA_MEM_TYPE_KMALLOC: ··· 2281 2276 printk(KERN_ERR 2282 2277 "%s: Unsupported memory type: %d\n", 2283 2278 __func__, region->memType); 2284 - return -EINVAL; 2279 + rc = -EINVAL; 2280 + goto out; 2285 2281 } 2286 2282 } 2287 2283 ··· 2320 2314 memMap->numRegionsUsed = 0; 2321 2315 memMap->inUse = 0; 2322 2316 2317 + out: 2323 2318 up(&memMap->lock); 2324 2319 2325 - return 0; 2320 + return rc; 2326 2321 } 2327 2322 2328 2323 EXPORT_SYMBOL(dma_unmap);