drm/ttm: fix memory leak noticed by kmemleak.
authorDave Airlie <airlied@redhat.com>
Tue, 8 Dec 2009 05:58:08 +0000 (15:58 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 9 Dec 2009 03:29:37 +0000 (13:29 +1000)
If we don't need the zone we need to free it.

Acked-By: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/ttm/ttm_memory.c

index 8bfde5f..f5245c0 100644 (file)
@@ -323,8 +323,10 @@ static int ttm_mem_init_dma32_zone(struct ttm_mem_global *glob,
         * No special dma32 zone needed.
         */
 
-       if (mem <= ((uint64_t) 1ULL << 32))
+       if (mem <= ((uint64_t) 1ULL << 32)) {
+               kfree(zone);
                return 0;
+       }
 
        /*
         * Limit max dma32 memory to 4GB for now