Skip to content

Commit

Permalink
tracing: Do not call kmem_cache_free() on allocation failure
Browse files Browse the repository at this point in the history
There's no point calling it when _alloc() failed.

Link: http://lkml.kernel.org/r/1370585268-29169-1-git-send-email-namhyung@kernel.org

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Namhyung Kim authored and Steven Rostedt committed Jun 11, 2013
1 parent 1b3d062 commit aaf6ac0
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static int __trace_define_field(struct list_head *head, const char *type,

field = kmem_cache_alloc(field_cachep, GFP_TRACE);
if (!field)
goto err;
return -ENOMEM;

field->name = name;
field->type = type;
Expand All @@ -114,11 +114,6 @@ static int __trace_define_field(struct list_head *head, const char *type,
list_add(&field->link, head);

return 0;

err:
kmem_cache_free(field_cachep, field);

return -ENOMEM;
}

int trace_define_field(struct ftrace_event_call *call, const char *type,
Expand Down

0 comments on commit aaf6ac0

Please sign in to comment.