soc: qcom: common_log: Fix a memory leak in common_log driver

Fix the memory leak in common_log_register_log_buf() function
when registering log_first_idx with the memory with dump v2 driver.
Also use kmemleak_not_leak when msm_dump_data_register() calls
are successful to ensure that kmemleak doesn't report it as a memory
leak.

CRs-Fixed: 832905
Change-Id: I36eaeebf821f64dd7503ec823aca3c7aec846bd0
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Signed-off-by: Shashank Mittal <mittals@codeaurora.org>
This commit is contained in:
Prasad Sodagudi 2015-05-12 10:05:14 +05:30 committed by Jeevan Shriram
parent 6f938760b7
commit 79333c3723

View file

@ -16,6 +16,7 @@
#include <linux/init.h>
#include <linux/kallsyms.h>
#include <linux/slab.h>
#include <linux/kmemleak.h>
#include <soc/qcom/memory_dump.h>
#define MISC_DUMP_DATA_LEN 4096
@ -196,7 +197,9 @@ static void __init common_log_register_log_buf(void)
&entry_log_buf)) {
kfree(dump_data);
pr_err("Unable to register %d.\n", entry_log_buf.id);
}
} else
kmemleak_not_leak(dump_data);
if (fist_idxp) {
dump_data = kzalloc(sizeof(struct msm_dump_data),
GFP_KERNEL);
@ -206,9 +209,12 @@ static void __init common_log_register_log_buf(void)
entry_first_idx.id = MSM_DUMP_DATA_LOG_BUF_FIRST_IDX;
entry_first_idx.addr = virt_to_phys(dump_data);
if (msm_dump_data_register(MSM_DUMP_TABLE_APPS,
&entry_first_idx))
&entry_first_idx)) {
kfree(dump_data);
pr_err("Unable to register %d.\n",
entry_first_idx.id);
} else
kmemleak_not_leak(dump_data);
}
}
}