Commit 0f59dca6 authored by Florent Revest's avatar Florent Revest Committed by Will Deacon

arm64: ftrace: Simplify get_ftrace_plt

Following recent refactorings, the get_ftrace_plt function only ever
gets called with addr = FTRACE_ADDR so its code can be simplified to
always return the ftrace trampoline plt.
Signed-off-by: default avatarFlorent Revest <revest@chromium.org>
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20230405180250.2046566-3-revest@chromium.orgSigned-off-by: default avatarWill Deacon <will@kernel.org>
parent 2aa6ac03
...@@ -195,15 +195,15 @@ int ftrace_update_ftrace_func(ftrace_func_t func) ...@@ -195,15 +195,15 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
return ftrace_modify_code(pc, 0, new, false); return ftrace_modify_code(pc, 0, new, false);
} }
static struct plt_entry *get_ftrace_plt(struct module *mod, unsigned long addr) static struct plt_entry *get_ftrace_plt(struct module *mod)
{ {
#ifdef CONFIG_ARM64_MODULE_PLTS #ifdef CONFIG_ARM64_MODULE_PLTS
struct plt_entry *plt = mod->arch.ftrace_trampolines; struct plt_entry *plt = mod->arch.ftrace_trampolines;
if (addr == FTRACE_ADDR) return &plt[FTRACE_PLT_IDX];
return &plt[FTRACE_PLT_IDX]; #else
#endif
return NULL; return NULL;
#endif
} }
static bool reachable_by_bl(unsigned long addr, unsigned long pc) static bool reachable_by_bl(unsigned long addr, unsigned long pc)
...@@ -270,7 +270,7 @@ static bool ftrace_find_callable_addr(struct dyn_ftrace *rec, ...@@ -270,7 +270,7 @@ static bool ftrace_find_callable_addr(struct dyn_ftrace *rec,
if (WARN_ON(!mod)) if (WARN_ON(!mod))
return false; return false;
plt = get_ftrace_plt(mod, *addr); plt = get_ftrace_plt(mod);
if (!plt) { if (!plt) {
pr_err("ftrace: no module PLT for %ps\n", (void *)*addr); pr_err("ftrace: no module PLT for %ps\n", (void *)*addr);
return false; return false;
......
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