aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_selftest.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 499d01c44cd1..00dd6485bdd7 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -757,7 +757,7 @@ int
757trace_selftest_startup_hw_branches(struct tracer *trace, 757trace_selftest_startup_hw_branches(struct tracer *trace,
758 struct trace_array *tr) 758 struct trace_array *tr)
759{ 759{
760 struct trace_iterator iter; 760 struct trace_iterator *iter;
761 struct tracer tracer; 761 struct tracer tracer;
762 unsigned long count; 762 unsigned long count;
763 int ret; 763 int ret;
@@ -777,17 +777,21 @@ trace_selftest_startup_hw_branches(struct tracer *trace,
777 * The hw-branch tracer needs to collect the trace from the various 777 * The hw-branch tracer needs to collect the trace from the various
778 * cpu trace buffers - before tracing is stopped. 778 * cpu trace buffers - before tracing is stopped.
779 */ 779 */
780 memset(&iter, 0, sizeof(iter)); 780 iter = kzalloc(sizeof(*iter), GFP_KERNEL);
781 if (!iter)
782 return -ENOMEM;
783
781 memcpy(&tracer, trace, sizeof(tracer)); 784 memcpy(&tracer, trace, sizeof(tracer));
782 785
783 iter.trace = &tracer; 786 iter->trace = &tracer;
784 iter.tr = tr; 787 iter->tr = tr;
785 iter.pos = -1; 788 iter->pos = -1;
786 mutex_init(&iter.mutex); 789 mutex_init(&iter->mutex);
787 790
788 trace->open(&iter); 791 trace->open(iter);
789 792
790 mutex_destroy(&iter.mutex); 793 mutex_destroy(&iter->mutex);
794 kfree(iter);
791 795
792 tracing_stop(); 796 tracing_stop();
793 797