Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f5da52aa authored by Prasad Sodagudi's avatar Prasad Sodagudi
Browse files

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: default avatarPrasad Sodagudi <psodagud@codeaurora.org>
parent 33697ae3
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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
@@ -210,7 +211,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);
@@ -222,9 +225,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);
		}
	}
}