hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/kernel/ksysfs.c
....@@ -1,11 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * kernel/ksysfs.c - sysfs attributes in /sys/kernel, which
34 * are not related to any other subsystem
45 *
56 * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
6
- *
7
- * This file is release under the GPLv2
8
- *
97 */
108
119 #include <linux/kobject.h>
....@@ -108,7 +106,12 @@
108106 static ssize_t kexec_crash_size_show(struct kobject *kobj,
109107 struct kobj_attribute *attr, char *buf)
110108 {
111
- return sprintf(buf, "%zu\n", crash_get_memory_size());
109
+ ssize_t size = crash_get_memory_size();
110
+
111
+ if (size < 0)
112
+ return size;
113
+
114
+ return sprintf(buf, "%zd\n", size);
112115 }
113116 static ssize_t kexec_crash_size_store(struct kobject *kobj,
114117 struct kobj_attribute *attr,
....@@ -139,15 +142,6 @@
139142 KERNEL_ATTR_RO(vmcoreinfo);
140143
141144 #endif /* CONFIG_CRASH_CORE */
142
-
143
-#if defined(CONFIG_PREEMPT_RT_FULL)
144
-static ssize_t realtime_show(struct kobject *kobj,
145
- struct kobj_attribute *attr, char *buf)
146
-{
147
- return sprintf(buf, "%d\n", 1);
148
-}
149
-KERNEL_ATTR_RO(realtime);
150
-#endif
151145
152146 /* whether file capabilities are enabled */
153147 static ssize_t fscaps_show(struct kobject *kobj,
....@@ -240,9 +234,6 @@
240234 &rcu_expedited_attr.attr,
241235 &rcu_normal_attr.attr,
242236 #endif
243
-#ifdef CONFIG_PREEMPT_RT_FULL
244
- &realtime_attr.attr,
245
-#endif
246237 NULL
247238 };
248239
....@@ -280,8 +271,4 @@
280271 return error;
281272 }
282273
283
-#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT
284
-pure_initcall(ksysfs_init);
285
-#else
286274 core_initcall(ksysfs_init);
287
-#endif