hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/arm/bifrost/debug/mali_kbase_debug_ktrace.c
....@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
22 /*
33 *
4
- * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2020-2022 ARM Limited. All rights reserved.
55 *
66 * This program is free software and is provided to you under the terms of the
77 * GNU General Public License version 2 as published by the Free Software
....@@ -27,13 +27,13 @@
2727 #if KBASE_KTRACE_TARGET_RBUF
2828 struct kbase_ktrace_msg *rbuf;
2929
30
+ spin_lock_init(&kbdev->ktrace.lock);
3031 rbuf = kmalloc_array(KBASE_KTRACE_SIZE, sizeof(*rbuf), GFP_KERNEL);
3132
3233 if (!rbuf)
3334 return -EINVAL;
3435
3536 kbdev->ktrace.rbuf = rbuf;
36
- spin_lock_init(&kbdev->ktrace.lock);
3737 #endif /* KBASE_KTRACE_TARGET_RBUF */
3838 return 0;
3939 }
....@@ -42,6 +42,7 @@
4242 {
4343 #if KBASE_KTRACE_TARGET_RBUF
4444 kfree(kbdev->ktrace.rbuf);
45
+ kbdev->ktrace.rbuf = NULL;
4546 #endif /* KBASE_KTRACE_TARGET_RBUF */
4647 }
4748
....@@ -183,6 +184,9 @@
183184 unsigned long irqflags;
184185 struct kbase_ktrace_msg *trace_msg;
185186
187
+ if (unlikely(!kbasep_ktrace_initialized(&kbdev->ktrace)))
188
+ return;
189
+
186190 WARN_ON((flags & ~KBASE_KTRACE_FLAG_COMMON_ALL));
187191
188192 spin_lock_irqsave(&kbdev->ktrace.lock, irqflags);