int ret = -EBUSY;
        int cpu;
 
-       preempt_disable_notrace();
+       guard(preempt_notrace)();
 
        if (atomic_read(&buffer->record_disabled))
-               goto out;
+               return -EBUSY;
 
        cpu = raw_smp_processor_id();
 
        if (!cpumask_test_cpu(cpu, buffer->cpumask))
-               goto out;
+               return -EBUSY;
 
        cpu_buffer = buffer->buffers[cpu];
 
        if (atomic_read(&cpu_buffer->record_disabled))
-               goto out;
+               return -EBUSY;
 
        if (length > buffer->max_data_size)
-               goto out;
+               return -EBUSY;
 
        if (unlikely(trace_recursive_lock(cpu_buffer)))
-               goto out;
+               return -EBUSY;
 
        event = rb_reserve_next_event(buffer, cpu_buffer, length);
        if (!event)
 
  out_unlock:
        trace_recursive_unlock(cpu_buffer);
-
- out:
-       preempt_enable_notrace();
-
        return ret;
 }
 EXPORT_SYMBOL_GPL(ring_buffer_write);