/* These are for everybody (although not all archs will actually
    discard it in modules) */
-#define __init         __section(.init.text) __cold __inittrace __latent_entropy
+#define __init         __section(.init.text) __cold  __latent_entropy
 #define __initdata     __section(.init.data)
 #define __initconst    __section(.init.rodata)
 #define __exitdata     __section(.exit.data)
 
 #ifdef MODULE
 #define __exitused
-#define __inittrace notrace
 #else
 #define __exitused  __used
-#define __inittrace
 #endif
 
 #define __exit          __section(.exit.text) __exitused __cold notrace
 
        if (!mod->async_probe_requested && (current->flags & PF_USED_ASYNC))
                async_synchronize_full();
 
+       ftrace_free_mem(mod->init_layout.base, mod->init_layout.base +
+                       mod->init_layout.size);
        mutex_lock(&module_mutex);
        /* Drop initial reference. */
        module_put(mod);
 
        last_pg = &ftrace_pages_start;
        for (pg = ftrace_pages_start; pg; pg = *last_pg) {
                rec = &pg->records[0];
-               if (within_module_core(rec->ip, mod)) {
+               if (within_module_core(rec->ip, mod) ||
+                   within_module_init(rec->ip, mod)) {
                        /*
                         * As core pages are first, the first
                         * page should never be a module page.
                 * not part of this module, then skip this pg,
                 * which the "break" will do.
                 */
-               if (!within_module_core(rec->ip, mod))
+               if (!within_module_core(rec->ip, mod) &&
+                   !within_module_init(rec->ip, mod))
                        break;
 
                cnt = 0;