hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/arch/powerpc/platforms/powernv/opal-elog.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Error log support on PowerNV.
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 #include <linux/kernel.h>
128 #include <linux/init.h>
....@@ -76,9 +72,14 @@
7672 const char *buf,
7773 size_t count)
7874 {
79
- opal_send_ack_elog(elog_obj->id);
80
- sysfs_remove_file_self(&elog_obj->kobj, &attr->attr);
81
- kobject_put(&elog_obj->kobj);
75
+ /*
76
+ * Try to self remove this attribute. If we are successful,
77
+ * delete the kobject itself.
78
+ */
79
+ if (sysfs_remove_file_self(&elog_obj->kobj, &attr->attr)) {
80
+ opal_send_ack_elog(elog_obj->id);
81
+ kobject_put(&elog_obj->kobj);
82
+ }
8283 return count;
8384 }
8485