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

Previous thread: udf: add speciffic ->setattr callback by Linux Kernel Mailing List on Monday, April 12, 2010 - 7:59 pm. (1 message)

Next thread: MIPS: Sibyte: Fix M3 TLB exception handler workaround. by Linux Kernel Mailing List on Monday, April 12, 2010 - 7:59 pm. (1 message)
From: Linux Kernel Mailing List
Date: Monday, April 12, 2010 - 7:59 pm

Gitweb:     http://git.kernel.org/linus/76708ab83962732ba3191ce8a61d8410406c8358
Commit:     76708ab83962732ba3191ce8a61d8410406c8358
Parent:     0fdf86754f70e813845af4abaa805165ce57a0bb
Author:     Leo Chen <leochen@broadcom.com>
AuthorDate: Thu Apr 1 19:13:19 2010 +0100
Committer:  Russell King <rmk+kernel@arm.linux.org.uk>
CommitDate: Wed Apr 7 21:11:27 2010 +0100

    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>
---
 arch/arm/mach-bcmring/dma.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-bcmring/dma.c b/arch/arm/mach-bcmring/dma.c
index 2ccf670..29c0a91 100644
--- a/arch/arm/mach-bcmring/dma.c
+++ b/arch/arm/mach-bcmring/dma.c
@@ -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 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];
 
@@ -2239,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:
@@ -2276,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__, ...
Previous thread: udf: add speciffic ->setattr callback by Linux Kernel Mailing List on Monday, April 12, 2010 - 7:59 pm. (1 message)

Next thread: MIPS: Sibyte: Fix M3 TLB exception handler workaround. by Linux Kernel Mailing List on Monday, April 12, 2010 - 7:59 pm. (1 message)