return ftrace_modify_code(pc, 0, new, false);
 }
 
-#ifdef CONFIG_ARM64_MODULE_PLTS
 static struct plt_entry *get_ftrace_plt(struct module *mod, unsigned long addr)
 {
+#ifdef CONFIG_ARM64_MODULE_PLTS
        struct plt_entry *plt = mod->arch.ftrace_trampolines;
 
        if (addr == FTRACE_ADDR)
                return &plt[FTRACE_PLT_IDX];
        if (addr == FTRACE_REGS_ADDR && IS_ENABLED(CONFIG_FTRACE_WITH_REGS))
                return &plt[FTRACE_REGS_PLT_IDX];
+#endif
        return NULL;
 }
-#endif
 
 /*
  * Turn on the call to ftrace_caller() in instrumented function
        long offset = (long)pc - (long)addr;
 
        if (offset < -SZ_128M || offset >= SZ_128M) {
-#ifdef CONFIG_ARM64_MODULE_PLTS
                struct module *mod;
                struct plt_entry *plt;
 
+               if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
+                       return -EINVAL;
+
                /*
                 * On kernels that support module PLTs, the offset between the
                 * branch instruction and its target may legally exceed the
                }
 
                addr = (unsigned long)plt;
-#else /* CONFIG_ARM64_MODULE_PLTS */
-               return -EINVAL;
-#endif /* CONFIG_ARM64_MODULE_PLTS */
        }
 
        old = aarch64_insn_gen_nop();
        long offset = (long)pc - (long)addr;
 
        if (offset < -SZ_128M || offset >= SZ_128M) {
-#ifdef CONFIG_ARM64_MODULE_PLTS
                u32 replaced;
 
+               if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
+                       return -EINVAL;
+
                /*
                 * 'mod' is only set at module load time, but if we end up
                 * dealing with an out-of-range condition, we can assume it
                        return -EINVAL;
 
                validate = false;
-#else /* CONFIG_ARM64_MODULE_PLTS */
-               return -EINVAL;
-#endif /* CONFIG_ARM64_MODULE_PLTS */
        } else {
                old = aarch64_insn_gen_branch_imm(pc, addr,
                                                  AARCH64_INSN_BRANCH_LINK);