mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
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>
This commit is contained in:
parent
0fdf86754f
commit
76708ab839
1 changed files with 10 additions and 3 deletions
|
@ -2221,11 +2221,15 @@ EXPORT_SYMBOL(dma_map_create_descriptor_ring);
|
||||||
int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
|
int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
|
||||||
int dirtied /* non-zero if any of the pages were modified */
|
int dirtied /* non-zero if any of the pages were modified */
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
int rc = 0;
|
||||||
int regionIdx;
|
int regionIdx;
|
||||||
int segmentIdx;
|
int segmentIdx;
|
||||||
DMA_Region_t *region;
|
DMA_Region_t *region;
|
||||||
DMA_Segment_t *segment;
|
DMA_Segment_t *segment;
|
||||||
|
|
||||||
|
down(&memMap->lock);
|
||||||
|
|
||||||
for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) {
|
for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) {
|
||||||
region = &memMap->region[regionIdx];
|
region = &memMap->region[regionIdx];
|
||||||
|
|
||||||
|
@ -2239,7 +2243,8 @@ int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"%s: vmalloc'd pages are not yet supported\n",
|
"%s: vmalloc'd pages are not yet supported\n",
|
||||||
__func__);
|
__func__);
|
||||||
return -EINVAL;
|
rc = -EINVAL;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DMA_MEM_TYPE_KMALLOC:
|
case DMA_MEM_TYPE_KMALLOC:
|
||||||
|
@ -2276,7 +2281,8 @@ int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"%s: Unsupported memory type: %d\n",
|
"%s: Unsupported memory type: %d\n",
|
||||||
__func__, region->memType);
|
__func__, region->memType);
|
||||||
return -EINVAL;
|
rc = -EINVAL;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2314,9 +2320,10 @@ int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */
|
||||||
memMap->numRegionsUsed = 0;
|
memMap->numRegionsUsed = 0;
|
||||||
memMap->inUse = 0;
|
memMap->inUse = 0;
|
||||||
|
|
||||||
|
out:
|
||||||
up(&memMap->lock);
|
up(&memMap->lock);
|
||||||
|
|
||||||
return 0;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(dma_unmap);
|
EXPORT_SYMBOL(dma_unmap);
|
||||||
|
|
Loading…
Reference in a new issue