Merge tag 'trace-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux...
[linux-2.6-block.git] / kernel / trace / ftrace.c
index 5c3eadb143ed4c7b6ae68a44d58c60e13d989edc..eca34503f178ece3f25a469ed3d73f186fd98c9e 100644 (file)
@@ -2937,14 +2937,13 @@ static int ftrace_update_code(struct module *mod, struct ftrace_page *new_pgs)
                        p = &pg->records[i];
                        p->flags = rec_flags;
 
-#ifndef CC_USING_NOP_MCOUNT
                        /*
                         * Do the initial record conversion from mcount jump
                         * to the NOP instructions.
                         */
-                       if (!ftrace_code_disable(mod, p))
+                       if (!__is_defined(CC_USING_NOP_MCOUNT) &&
+                           !ftrace_code_disable(mod, p))
                                break;
-#endif
 
                        update_cnt++;
                }
@@ -4223,10 +4222,13 @@ void free_ftrace_func_mapper(struct ftrace_func_mapper *mapper,
        struct ftrace_func_entry *entry;
        struct ftrace_func_map *map;
        struct hlist_head *hhd;
-       int size = 1 << mapper->hash.size_bits;
-       int i;
+       int size, i;
+
+       if (!mapper)
+               return;
 
        if (free_func && mapper->hash.count) {
+               size = 1 << mapper->hash.size_bits;
                for (i = 0; i < size; i++) {
                        hhd = &mapper->hash.buckets[i];
                        hlist_for_each_entry(entry, hhd, hlist) {