[for-next][PATCH 07/12] tracing: Do not call kmem_cache_free() on allocation failure

From: Steven Rostedt
Date: Wed Jun 19 2013 - 23:39:18 EST


From: Namhyung Kim <namhyung.kim@xxxxxxx>

There's no point calling it when _alloc() failed.

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

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
kernel/trace/trace_events.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index db086f1..f57b015 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -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;
@@ -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,
--
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/