Commit 5aba61be authored by Simon Que's avatar Simon Que Committed by Hari Kanigeri

SYSLINK: ipc - cleanup for platform_mem

sysmgr_destroy was not cleaning up platform_mem.  As a result, memory allocated
by platform_mem_setup was not freed by platform_mem_destroy.  This has been
fixed.  Also, platform_mem_destroy was incorrectly freeing the allocated gate
handle.  It now frees it correctly.
Signed-off-by: default avatarSimon Que <sque@ti.com>
parent 20dc3750
...@@ -117,7 +117,7 @@ int platform_mem_destroy(void) ...@@ -117,7 +117,7 @@ int platform_mem_destroy(void)
== PLATFORM_MEM_MAKE_MAGICSTAMP(0)) { == PLATFORM_MEM_MAKE_MAGICSTAMP(0)) {
list_del(&platform_mem_state.map_table); list_del(&platform_mem_state.map_table);
/* Delete the gate handle */ /* Delete the gate handle */
kfree(&platform_mem_state.gate); kfree(platform_mem_state.gate);
} }
exit: exit:
......
...@@ -137,6 +137,8 @@ struct sysmgr_module_object { ...@@ -137,6 +137,8 @@ struct sysmgr_module_object {
/* Overall system configuration */ /* Overall system configuration */
struct sysmgr_boot_load_page *boot_load_page[MULTIPROC_MAXPROCESSORS]; struct sysmgr_boot_load_page *boot_load_page[MULTIPROC_MAXPROCESSORS];
/* Boot load page of the slaves */ /* Boot load page of the slaves */
bool platform_mem_init_flag;
/* Platform memory manager initialize flag */
bool multiproc_init_flag; bool multiproc_init_flag;
/* Multiproc Initialize flag */ /* Multiproc Initialize flag */
bool gatepeterson_init_flag; bool gatepeterson_init_flag;
...@@ -373,8 +375,9 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg) ...@@ -373,8 +375,9 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
printk(KERN_ERR "sysmgr_setup : platform_mem_setup " printk(KERN_ERR "sysmgr_setup : platform_mem_setup "
"failed [0x%x]\n", status); "failed [0x%x]\n", status);
} else { } else {
printk(KERN_ERR "platform_mem_setup_setup : status [0x%x]\n" , printk(KERN_ERR "platform_mem_setup : status [0x%x]\n" ,
status); status);
sysmgr_state.platform_mem_init_flag = true;
} }
/* Override the platform specific configuration */ /* Override the platform specific configuration */
...@@ -733,6 +736,17 @@ s32 sysmgr_destroy(void) ...@@ -733,6 +736,17 @@ s32 sysmgr_destroy(void)
} }
} }
/* Finalize PlatformMem module */
if (sysmgr_state.platform_mem_init_flag == true) {
status = platform_mem_destroy();
if (status < 0) {
printk(KERN_ERR "sysmgr_destroy : platform_mem_destroy "
"failed [0x%x]\n", status);
} else {
sysmgr_state.platform_mem_init_flag = false;
}
}
atomic_set(&sysmgr_state.ref_count, SYSMGR_MAKE_MAGICSTAMP(0)); atomic_set(&sysmgr_state.ref_count, SYSMGR_MAKE_MAGICSTAMP(0));
exit: exit:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment