msm: kgsl: Make sure kmemleak tool does not report incorrect mem leak.

Certain memory allocations are not properly tracked by kmemleak tool,
which makes it to incorrectly detect memory leak. Notify the tool by using
kmemleak_not_leak() to ignore the memory allocation so that incorrect leaks
report are avoided.
This commit is contained in:
securecrt 2012-06-21 13:01:23 +08:00
parent dcf924f072
commit 9d909cf27b
2 changed files with 9 additions and 0 deletions

View File

@ -14,6 +14,8 @@
#include <linux/vmalloc.h>
#include <linux/memory_alloc.h>
#include <asm/cacheflush.h>
#include <linux/slab.h>
#include <linux/kmemleak.h>
#include "kgsl.h"
#include "kgsl_sharedmem.h"
@ -361,6 +363,8 @@ _kgsl_sharedmem_vmalloc(struct kgsl_memdesc *memdesc,
goto done;
}
kmemleak_not_leak(memdesc->sg);
memdesc->sglen = sglen;
sg_init_table(memdesc->sg, sglen);
@ -435,6 +439,8 @@ kgsl_sharedmem_vmalloc_user(struct kgsl_memdesc *memdesc,
return -ENOMEM;
}
kmemleak_not_leak(ptr);
protflags = GSL_PT_PAGE_RV;
if (!(flags & KGSL_MEMFLAGS_GPUREADONLY))
protflags |= GSL_PT_PAGE_WV;

3
drivers/gpu/msm/kgsl_sharedmem.h Normal file → Executable file
View File

@ -16,6 +16,7 @@
#include <linux/slab.h>
#include <linux/dma-mapping.h>
#include <linux/kmemleak.h>
/*
* Convert a page to a physical address
@ -90,6 +91,8 @@ memdesc_sg_phys(struct kgsl_memdesc *memdesc,
if (memdesc->sg == NULL)
return -ENOMEM;
kmemleak_not_leak(memdesc->sg);
memdesc->sglen = 1;
sg_init_table(memdesc->sg, 1);
sg_set_page(&memdesc->sg[0], page, size, 0);