linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] function_graph: remove unnecessary initialization in ftrace_graph_ret_addr()
@ 2024-09-16 13:56 Oleg Nesterov
  2024-09-16 16:39 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2024-09-16 13:56 UTC (permalink / raw)
  To: Masami Hiramatsu, Puranjay Mohan, Steven Rostedt
  Cc: linux-kernel, linux-trace-kernel

After the commit 29c1c24a2707 ("function_graph: Fix up ftrace_graph_ret_addr()")
ftrace_graph_ret_addr() doesn't need to initialize "int i" at the start.

While at it, move the declaration of "ret_stack" into the main loop.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 kernel/trace/fgraph.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index d7d4fb403f6f..d45a8bc97997 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -890,9 +890,8 @@ ftrace_graph_get_ret_stack(struct task_struct *task, int idx)
 unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
 				    unsigned long ret, unsigned long *retp)
 {
-	struct ftrace_ret_stack *ret_stack;
 	unsigned long return_handler = (unsigned long)dereference_kernel_function_descriptor(return_to_handler);
-	int i = task->curr_ret_stack;
+	int i;
 
 	if (ret != return_handler)
 		return ret;
@@ -902,7 +901,7 @@ unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
 
 	i = *idx ? : task->curr_ret_stack;
 	while (i > 0) {
-		ret_stack = get_ret_stack(task, i, &i);
+		struct ftrace_ret_stack *ret_stack = get_ret_stack(task, i, &i);
 		if (!ret_stack)
 			break;
 		/*
-- 
2.25.1.362.g51ebf55



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-16 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-16 13:56 [PATCH] function_graph: remove unnecessary initialization in ftrace_graph_ret_addr() Oleg Nesterov
2024-09-16 16:39 ` Steven Rostedt
2024-09-16 17:58   ` [PATCH v2] " Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).