Skip to content

Commit 77e53cb

Browse files
committed
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 <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Andrew Morton <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent ac8c3b0 commit 77e53cb

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

kernel/trace/ftrace.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,14 +1669,12 @@ unsigned long ftrace_location(unsigned long ip)
16691669
loc = ftrace_location_range(ip, ip);
16701670
if (!loc) {
16711671
if (!kallsyms_lookup_size_offset(ip, &size, &offset))
1672-
goto out;
1672+
return 0;
16731673

16741674
/* map sym+0 to __fentry__ */
16751675
if (!offset)
16761676
loc = ftrace_location_range(ip, ip + size - 1);
16771677
}
1678-
1679-
out:
16801678
return loc;
16811679
}
16821680

@@ -2071,7 +2069,7 @@ static int __ftrace_hash_update_ipmodify(struct ftrace_ops *ops,
20712069
continue;
20722070

20732071
if (rec == end)
2074-
goto err_out;
2072+
return -EBUSY;
20752073

20762074
in_old = !!ftrace_lookup_ip(old_hash, rec->ip);
20772075
in_new = !!ftrace_lookup_ip(new_hash, rec->ip);
@@ -2084,7 +2082,6 @@ static int __ftrace_hash_update_ipmodify(struct ftrace_ops *ops,
20842082
rec->flags |= FTRACE_FL_IPMODIFY;
20852083
} while_for_each_ftrace_rec();
20862084

2087-
err_out:
20882085
return -EBUSY;
20892086
}
20902087

@@ -5720,12 +5717,10 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
57205717
parser->idx, enable);
57215718
trace_parser_clear(parser);
57225719
if (ret < 0)
5723-
goto out;
5720+
return ret;
57245721
}
57255722

5726-
ret = read;
5727-
out:
5728-
return ret;
5723+
return read;
57295724
}
57305725

57315726
ssize_t

0 commit comments

Comments
 (0)