.. | .. |
---|
1 | 1 | // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note |
---|
2 | 2 | /* |
---|
3 | 3 | * |
---|
4 | | - * (C) COPYRIGHT 2016-2021 ARM Limited. All rights reserved. |
---|
| 4 | + * (C) COPYRIGHT 2016-2022 ARM Limited. All rights reserved. |
---|
5 | 5 | * |
---|
6 | 6 | * This program is free software and is provided to you under the terms of the |
---|
7 | 7 | * GNU General Public License version 2 as published by the Free Software |
---|
.. | .. |
---|
93 | 93 | debugfs_directory = debugfs_create_dir("address_spaces", |
---|
94 | 94 | kbdev->mali_debugfs_directory); |
---|
95 | 95 | |
---|
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)) { |
---|
105 | 97 | dev_warn(kbdev->dev, |
---|
106 | 98 | "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 | + } |
---|
107 | 105 | } |
---|
108 | 106 | |
---|
109 | 107 | #endif /* CONFIG_MALI_BIFROST_DEBUG */ |
---|
110 | 108 | #endif /* CONFIG_DEBUG_FS */ |
---|
111 | | - return; |
---|
112 | 109 | } |
---|