| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Error log support on PowerNV. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | #include <linux/kernel.h> |
|---|
| 12 | 8 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 76 | 72 | const char *buf, |
|---|
| 77 | 73 | size_t count) |
|---|
| 78 | 74 | { |
|---|
| 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 | + } |
|---|
| 82 | 83 | return count; |
|---|
| 83 | 84 | } |
|---|
| 84 | 85 | |
|---|