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

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.org


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 2aa6ac03
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -195,15 +195,15 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
	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
	struct plt_entry *plt = mod->arch.ftrace_trampolines;

	if (addr == FTRACE_ADDR)
	return &plt[FTRACE_PLT_IDX];
#endif
#else
	return NULL;
#endif
}

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

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