diff mbox series

[08/12] riscv: remove unreachable !CONFIG_FRAME_POINTER code

Message ID 20190412143948.12478-9-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/12] riscv: use asm-generic/extable.h | expand

Commit Message

Christoph Hellwig April 12, 2019, 2:39 p.m. UTC
The RISC-V port selects CONFIG_ARCH_WANT_FRAME_POINTERS, which causes
CONFIG_FRAME_POINTER to always be set.  Remove the unreachable code
for the !CONFIG_FRAME_POINTER case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/riscv/include/asm/ftrace.h |  6 +-----
 arch/riscv/kernel/stacktrace.c  | 37 ---------------------------------
 2 files changed, 1 insertion(+), 42 deletions(-)
diff mbox series

Patch

diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrace.h
index c6dcc5291f97..c52073a065e5 100644
--- a/arch/riscv/include/asm/ftrace.h
+++ b/arch/riscv/include/asm/ftrace.h
@@ -1,11 +1,7 @@ 
 /* SPDX-License-Identifier: GPL-2.0 */
 /* Copyright (C) 2017 Andes Technology Corporation */
 
-/*
- * The graph frame test is not possible if CONFIG_FRAME_POINTER is not enabled.
- * Check arch/riscv/kernel/mcount.S for detail.
- */
-#if defined(CONFIG_FUNCTION_GRAPH_TRACER) && defined(CONFIG_FRAME_POINTER)
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
 #define HAVE_FUNCTION_GRAPH_FP_TEST
 #endif
 #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index a4b1d94371a0..3cb439f8c7e6 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -20,8 +20,6 @@ 
 #include <linux/stacktrace.h>
 #include <linux/ftrace.h>
 
-#ifdef CONFIG_FRAME_POINTER
-
 struct stackframe {
 	unsigned long fp;
 	unsigned long ra;
@@ -73,41 +71,6 @@  static void notrace walk_stackframe(struct task_struct *task,
 	}
 }
 
-#else /* !CONFIG_FRAME_POINTER */
-
-static void notrace walk_stackframe(struct task_struct *task,
-	struct pt_regs *regs, bool (*fn)(unsigned long, void *), void *arg)
-{
-	unsigned long sp, pc;
-	unsigned long *ksp;
-
-	if (regs) {
-		sp = GET_USP(regs);
-		pc = GET_IP(regs);
-	} else if (task == NULL || task == current) {
-		const register unsigned long current_sp __asm__ ("sp");
-		sp = current_sp;
-		pc = (unsigned long)walk_stackframe;
-	} else {
-		/* task blocked in __switch_to */
-		sp = task->thread.sp;
-		pc = task->thread.ra;
-	}
-
-	if (unlikely(sp & 0x7))
-		return;
-
-	ksp = (unsigned long *)sp;
-	while (!kstack_end(ksp)) {
-		if (__kernel_text_address(pc) && unlikely(fn(pc, arg)))
-			break;
-		pc = (*ksp++) - 0x4;
-	}
-}
-
-#endif /* CONFIG_FRAME_POINTER */
-
-
 static bool print_trace_address(unsigned long pc, void *arg)
 {
 	print_ip_sym(pc);