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:
parent
dcf924f072
commit
9d909cf27b
@ -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
3
drivers/gpu/msm/kgsl_sharedmem.h
Normal file → Executable 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user