hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/arm/bifrost/mali_kbase_as_fault_debugfs.c
....@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
22 /*
33 *
4
- * (C) COPYRIGHT 2016-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2016-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
....@@ -93,20 +93,17 @@
9393 debugfs_directory = debugfs_create_dir("address_spaces",
9494 kbdev->mali_debugfs_directory);
9595
96
- if (debugfs_directory) {
97
- for (i = 0; i < kbdev->nr_hw_address_spaces; i++) {
98
- snprintf(as_name, ARRAY_SIZE(as_name), "as%u", i);
99
- debugfs_create_file(as_name, S_IRUGO,
100
- debugfs_directory,
101
- (void *)(uintptr_t)i,
102
- &as_fault_fops);
103
- }
104
- } else {
96
+ if (IS_ERR_OR_NULL(debugfs_directory)) {
10597 dev_warn(kbdev->dev,
10698 "unable to create address_spaces debugfs directory");
99
+ } else {
100
+ for (i = 0; i < kbdev->nr_hw_address_spaces; i++) {
101
+ if (likely(scnprintf(as_name, ARRAY_SIZE(as_name), "as%u", i)))
102
+ debugfs_create_file(as_name, 0444, debugfs_directory,
103
+ (void *)(uintptr_t)i, &as_fault_fops);
104
+ }
107105 }
108106
109107 #endif /* CONFIG_MALI_BIFROST_DEBUG */
110108 #endif /* CONFIG_DEBUG_FS */
111
- return;
112109 }