forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/arch/powerpc/platforms/powernv/opal-dump.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * PowerNV OPAL Dump Interface
34 *
45 * Copyright 2013,2014 IBM Corp.
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the License, or (at your option) any later version.
106 */
117
128 #include <linux/kobject.h>
....@@ -92,9 +88,14 @@
9288 const char *buf,
9389 size_t count)
9490 {
95
- dump_send_ack(dump_obj->id);
96
- sysfs_remove_file_self(&dump_obj->kobj, &attr->attr);
97
- kobject_put(&dump_obj->kobj);
91
+ /*
92
+ * Try to self remove this attribute. If we are successful,
93
+ * delete the kobject itself.
94
+ */
95
+ if (sysfs_remove_file_self(&dump_obj->kobj, &attr->attr)) {
96
+ dump_send_ack(dump_obj->id);
97
+ kobject_put(&dump_obj->kobj);
98
+ }
9899 return count;
99100 }
100101