mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sample-trace-array: Remove trace_array 'sample-instance'
@ 2020-06-09 13:52 Kefeng Wang
  2020-06-09 16:30 ` Divya Indi
  0 siblings, 1 reply; 2+ messages in thread
From: Kefeng Wang @ 2020-06-09 13:52 UTC (permalink / raw)
  To: Divya Indi, linux-kernel; +Cc: Steven Rostedt, Aruna Ramakrishna, Kefeng Wang

Remove trace_array 'sample-instance' if kthread_run fails
in sample_trace_array_init().

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 samples/ftrace/sample-trace-array.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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;
 }
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-09 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 13:52 [PATCH] sample-trace-array: Remove trace_array 'sample-instance' Kefeng Wang
2020-06-09 16:30 ` Divya Indi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®