Merge branch 'v3.10/topic/configs' of git://git.linaro.org/kernel/linux-linaro-stable...
[firefly-linux-kernel-4.4.55.git] / kernel / trace / trace.c
index 5546ae9c84f97a2b54a98c201f670256850c0964..6dbdf277c8fedf308030cafc9e2ec66e14a31d0e 100644 (file)
@@ -424,6 +424,9 @@ int __trace_puts(unsigned long ip, const char *str, int size)
        unsigned long irq_flags;
        int alloc;
 
+       if (unlikely(tracing_selftest_running || tracing_disabled))
+               return 0;
+
        alloc = sizeof(*entry) + size + 2; /* possible \n added */
 
        local_save_flags(irq_flags);
@@ -464,6 +467,9 @@ int __trace_bputs(unsigned long ip, const char *str)
        unsigned long irq_flags;
        int size = sizeof(struct bputs_entry);
 
+       if (unlikely(tracing_selftest_running || tracing_disabled))
+               return 0;
+
        local_save_flags(irq_flags);
        buffer = global_trace.trace_buffer.buffer;
        event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
@@ -5878,6 +5884,8 @@ allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size
 
        rb_flags = trace_flags & TRACE_ITER_OVERWRITE ? RB_FL_OVERWRITE : 0;
 
+       buf->tr = tr;
+
        buf->buffer = ring_buffer_alloc(size, rb_flags);
        if (!buf->buffer)
                return -ENOMEM;