Generic dma-coherent: fix DMA_MEMORY_EXCLUSIVE
authorDmitry Baryshkov <dbaryshkov@gmail.com>
Fri, 18 Jul 2008 09:29:57 +0000 (13:29 +0400)
committerIngo Molnar <mingo@elte.hu>
Fri, 18 Jul 2008 19:14:01 +0000 (21:14 +0200)
Don't rewrite successfull allocation return values
in case the memory was marked with DMA_MEMORY_EXCLUSIVE.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/dma-coherent.c

index 89a554c..56dff5c 100644 (file)
@@ -105,8 +105,7 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size,
                        *dma_handle = mem->device_base + (page << PAGE_SHIFT);
                        *ret = mem->virt_base + (page << PAGE_SHIFT);
                        memset(*ret, 0, size);
-               }
-               if (mem->flags & DMA_MEMORY_EXCLUSIVE)
+               } else if (mem->flags & DMA_MEMORY_EXCLUSIVE)
                        *ret = NULL;
        }
        return (mem != NULL);