| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * kernel/ksysfs.c - sysfs attributes in /sys/kernel, which |
|---|
| 3 | 4 | * are not related to any other subsystem |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This file is release under the GPLv2 |
|---|
| 8 | | - * |
|---|
| 9 | 7 | */ |
|---|
| 10 | 8 | |
|---|
| 11 | 9 | #include <linux/kobject.h> |
|---|
| .. | .. |
|---|
| 108 | 106 | static ssize_t kexec_crash_size_show(struct kobject *kobj, |
|---|
| 109 | 107 | struct kobj_attribute *attr, char *buf) |
|---|
| 110 | 108 | { |
|---|
| 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); |
|---|
| 112 | 115 | } |
|---|
| 113 | 116 | static ssize_t kexec_crash_size_store(struct kobject *kobj, |
|---|
| 114 | 117 | struct kobj_attribute *attr, |
|---|
| .. | .. |
|---|
| 139 | 142 | KERNEL_ATTR_RO(vmcoreinfo); |
|---|
| 140 | 143 | |
|---|
| 141 | 144 | #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 |
|---|
| 151 | 145 | |
|---|
| 152 | 146 | /* whether file capabilities are enabled */ |
|---|
| 153 | 147 | static ssize_t fscaps_show(struct kobject *kobj, |
|---|
| .. | .. |
|---|
| 240 | 234 | &rcu_expedited_attr.attr, |
|---|
| 241 | 235 | &rcu_normal_attr.attr, |
|---|
| 242 | 236 | #endif |
|---|
| 243 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 244 | | - &realtime_attr.attr, |
|---|
| 245 | | -#endif |
|---|
| 246 | 237 | NULL |
|---|
| 247 | 238 | }; |
|---|
| 248 | 239 | |
|---|
| .. | .. |
|---|
| 280 | 271 | return error; |
|---|
| 281 | 272 | } |
|---|
| 282 | 273 | |
|---|
| 283 | | -#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT |
|---|
| 284 | | -pure_initcall(ksysfs_init); |
|---|
| 285 | | -#else |
|---|
| 286 | 274 | core_initcall(ksysfs_init); |
|---|
| 287 | | -#endif |
|---|