summaryrefslogtreecommitdiff
path: root/drivers/mxc
diff options
context:
space:
mode:
authorLoren Huang <b02279@freescale.com>2014-10-13 17:14:59 +0800
committerNitin Garg <nitin.garg@freescale.com>2015-01-15 21:18:28 -0600
commite7faf66958cdf8ff78cfe4023019213a6b4a8949 (patch)
treef87d7c67fb8739282f886e3679ffa497bffa2548 /drivers/mxc
parent41066b1297d60002f77e87c2662f110f9669bb82 (diff)
MGS-200 gpu:Correct the CMA allocator logic
In original logic, the CMA always allocate memory, but report allocation failure, it will cause serious memory leak. Correct logic to fix it. Date: Oct 13, 2014 Signed-off-by: Loren Huang <b02279@freescale.com> Acked-by: Shawn Guo (cherry picked from commit 0625c8b5b72c620269e5fd5feee93d51f4536d49)
Diffstat (limited to 'drivers/mxc')
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c
index d4611d019f38..1d44b59e1452 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/allocator/freescale/gc_hal_kernel_allocator_cma.c
@@ -97,7 +97,6 @@ _CMAFSLAlloc(
)
{
gceSTATUS status;
- gctPOINTER addr = gcvNULL;
gcsCMA_PRIV_PTR priv = (gcsCMA_PRIV_PTR)Allocator->privateData;
struct mdl_cma_priv *mdl_priv=gcvNULL;
@@ -106,13 +105,14 @@ _CMAFSLAlloc(
gcmkHEADER_ARG("Mdl=%p NumPages=%d", Mdl, NumPages);
gcmkONERROR(gckOS_Allocate(os, sizeof(struct mdl_cma_priv), (gctPOINTER *)&mdl_priv));
+ mdl_priv->kvaddr = gcvNULL;
mdl_priv->kvaddr = dma_alloc_writecombine(gcvNULL,
NumPages * PAGE_SIZE,
&mdl_priv->physical,
GFP_KERNEL | gcdNOWARN);
- if (addr == gcvNULL)
+ if (mdl_priv->kvaddr == gcvNULL)
{
gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY);
}