Skip to content

Commit

Permalink
tracing/histograms: Simplify create_hist_fields()
Browse files Browse the repository at this point in the history
When I look into implements of create_hist_fields(), I think there can be
following two simplifications:
  1. If something wrong happened in parse_var_defs(), free_var_defs() would
     have been called in it, so no need goto free again after calling it;
  2. After calling create_key_fields(), regardless of the value of 'ret', it
     then always runs into 'out: ', so the judge of 'ret' is redundant.

Link: https://lkml.kernel.org/r/20220630013152.164871-1-zhengyejian1@huawei.com

Signed-off-by: Zheng Yejian <zhengyejian1@huawei.com>
Reviewed-by: Tom Rix <trix@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
  • Loading branch information
Zheng Yejian authored and Steven Rostedt (Google) committed Jul 12, 2022
1 parent 94c255a commit fb991f1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions kernel/trace/trace_events_hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -4455,7 +4455,7 @@ static int create_hist_fields(struct hist_trigger_data *hist_data,

ret = parse_var_defs(hist_data);
if (ret)
goto out;
return ret;

ret = create_val_fields(hist_data, file);
if (ret)
Expand All @@ -4466,8 +4466,7 @@ static int create_hist_fields(struct hist_trigger_data *hist_data,
goto out;

ret = create_key_fields(hist_data, file);
if (ret)
goto out;

out:
free_var_defs(hist_data);

Expand Down

0 comments on commit fb991f1

Please sign in to comment.