| .. | .. |
|---|
| 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, |
|---|
| .. | .. |
|---|
| 268 | 271 | return error; |
|---|
| 269 | 272 | } |
|---|
| 270 | 273 | |
|---|
| 271 | | -#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT |
|---|
| 272 | | -pure_initcall(ksysfs_init); |
|---|
| 273 | | -#else |
|---|
| 274 | 274 | core_initcall(ksysfs_init); |
|---|
| 275 | | -#endif |
|---|