aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKefeng Wang <[email protected]>2020-06-09 13:52:00 +0000
committerSteven Rostedt (VMware) <[email protected]>2020-06-16 21:21:02 -0400
commit9fbc01cdba66e988122ccdc6094cfd85d9587769 (patch)
tree28d9512955eacc1e7ff4ffd892f4d08b34804a62
parente9b7b1c0c103a623be1a65c39f98719803440871 (diff)
sample-trace-array: Remove trace_array 'sample-instance'
Remove trace_array 'sample-instance' if kthread_run fails in sample_trace_array_init(). Link: https://lkml.kernel.org/r/[email protected] Cc: [email protected] Fixes: 89ed42495ef4a ("tracing: Sample module to demonstrate kernel access to Ftrace instances.") Reviewed-by: Divya Indi <[email protected]> Signed-off-by: Kefeng Wang <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
-rw-r--r--samples/ftrace/sample-trace-array.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/samples/ftrace/sample-trace-array.c b/samples/ftrace/sample-trace-array.c
index 9e437f930280..6aba02a31c96 100644
--- a/samples/ftrace/sample-trace-array.c
+++ b/samples/ftrace/sample-trace-array.c
@@ -115,8 +115,12 @@ static int __init sample_trace_array_init(void)
trace_printk_init_buffers();
simple_tsk = kthread_run(simple_thread, NULL, "sample-instance");
- if (IS_ERR(simple_tsk))
+ if (IS_ERR(simple_tsk)) {
+ trace_array_put(tr);
+ trace_array_destroy(tr);
return -1;
+ }
+
return 0;
}