Skip to content

Commit

Permalink
perf tools: Simplify event_read_id exit path
Browse files Browse the repository at this point in the history
We're freeing the token in any case so simplify the exit path by
unifying it.

No functional change.

Signed-off-by: Borislav Petkov <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
Borislav Petkov authored and acmel committed Mar 22, 2012
1 parent 0d09eb7 commit 842f07f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tools/perf/util/trace-event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ static char *event_read_name(void)
static int event_read_id(void)
{
char *token;
int id;
int id = -1;

if (read_expected_item(EVENT_ITEM, "ID") < 0)
return -1;
Expand All @@ -731,15 +731,13 @@ static int event_read_id(void)
return -1;

if (read_expect_type(EVENT_ITEM, &token) < 0)
goto fail;
goto free;

id = strtoul(token, NULL, 0);
free_token(token);
return id;

fail:
free:
free_token(token);
return -1;
return id;
}

static int field_is_string(struct format_field *field)
Expand Down

0 comments on commit 842f07f

Please sign in to comment.