Skip to content

Commit 0f59dca

Browse files
FlorentRevestwilldeacon
authored andcommitted
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: Florent Revest <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 2aa6ac0 commit 0f59dca

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/arm64/kernel/ftrace.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
195195
return ftrace_modify_code(pc, 0, new, false);
196196
}
197197

198-
static struct plt_entry *get_ftrace_plt(struct module *mod, unsigned long addr)
198+
static struct plt_entry *get_ftrace_plt(struct module *mod)
199199
{
200200
#ifdef CONFIG_ARM64_MODULE_PLTS
201201
struct plt_entry *plt = mod->arch.ftrace_trampolines;
202202

203-
if (addr == FTRACE_ADDR)
204-
return &plt[FTRACE_PLT_IDX];
205-
#endif
203+
return &plt[FTRACE_PLT_IDX];
204+
#else
206205
return NULL;
206+
#endif
207207
}
208208

209209
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,
270270
if (WARN_ON(!mod))
271271
return false;
272272

273-
plt = get_ftrace_plt(mod, *addr);
273+
plt = get_ftrace_plt(mod);
274274
if (!plt) {
275275
pr_err("ftrace: no module PLT for %ps\n", (void *)*addr);
276276
return false;

0 commit comments

Comments
 (0)