Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ftrace: Remove unneeded goto jumps

There are some goto jumps to exit a program to just return a value. The
code after the label doesn't free anything nor does it do any unlocks. It
simply returns the variable that was set before the jump.

Remove these unneeded goto jumps.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://lore.kernel.org/20241223184941.544855549@goodmis.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

+4 -9
+4 -9
kernel/trace/ftrace.c
··· 1669 1669 loc = ftrace_location_range(ip, ip); 1670 1670 if (!loc) { 1671 1671 if (!kallsyms_lookup_size_offset(ip, &size, &offset)) 1672 - goto out; 1672 + return 0; 1673 1673 1674 1674 /* map sym+0 to __fentry__ */ 1675 1675 if (!offset) 1676 1676 loc = ftrace_location_range(ip, ip + size - 1); 1677 1677 } 1678 - 1679 - out: 1680 1678 return loc; 1681 1679 } 1682 1680 ··· 2069 2071 continue; 2070 2072 2071 2073 if (rec == end) 2072 - goto err_out; 2074 + return -EBUSY; 2073 2075 2074 2076 in_old = !!ftrace_lookup_ip(old_hash, rec->ip); 2075 2077 in_new = !!ftrace_lookup_ip(new_hash, rec->ip); ··· 2082 2084 rec->flags |= FTRACE_FL_IPMODIFY; 2083 2085 } while_for_each_ftrace_rec(); 2084 2086 2085 - err_out: 2086 2087 return -EBUSY; 2087 2088 } 2088 2089 ··· 5717 5720 parser->idx, enable); 5718 5721 trace_parser_clear(parser); 5719 5722 if (ret < 0) 5720 - goto out; 5723 + return ret; 5721 5724 } 5722 5725 5723 - ret = read; 5724 - out: 5725 - return ret; 5726 + return read; 5726 5727 } 5727 5728 5728 5729 ssize_t