diff options
author | David S. Miller <davem@davemloft.net> | 2010-04-13 09:28:45 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-13 09:28:45 +0200 |
commit | 9343af084c7e8911897b0883042ee690cee3aaef (patch) | |
tree | 6211a4bdc84690bec6530d27a3abb19f5e8bb8f3 /arch/arm/mach-bcmring/dma.c | |
parent | sparc64: Fix memory leak in pci_register_iommu_region(). (diff) | |
parent | Linux 2.6.34-rc4 (diff) | |
download | linux-9343af084c7e8911897b0883042ee690cee3aaef.tar.xz linux-9343af084c7e8911897b0883042ee690cee3aaef.zip |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Conflicts:
lib/Kconfig.debug
Diffstat (limited to 'arch/arm/mach-bcmring/dma.c')
-rw-r--r-- | arch/arm/mach-bcmring/dma.c | 14 |
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 @@ #include <linux/interrupt.h> #include <linux/irqreturn.h> #include <linux/proc_fs.h> +#include <linux/slab.h> #include <mach/timer.h> @@ -2220,11 +2221,15 @@ EXPORT_SYMBOL(dma_map_create_descriptor_ring); 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 rc = 0; int regionIdx; int segmentIdx; DMA_Region_t *region; DMA_Segment_t *segment; + down(&memMap->lock); + for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) { region = &memMap->region[regionIdx]; @@ -2238,7 +2243,8 @@ int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */ printk(KERN_ERR "%s: vmalloc'd pages are not yet supported\n", __func__); - return -EINVAL; + rc = -EINVAL; + goto out; } case DMA_MEM_TYPE_KMALLOC: @@ -2275,7 +2281,8 @@ int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */ printk(KERN_ERR "%s: Unsupported memory type: %d\n", __func__, region->memType); - return -EINVAL; + rc = -EINVAL; + goto out; } } @@ -2313,9 +2320,10 @@ int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */ memMap->numRegionsUsed = 0; memMap->inUse = 0; +out: up(&memMap->lock); - return 0; + return rc; } EXPORT_SYMBOL(dma_unmap); |