| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * PowerNV OPAL Dump Interface |
|---|
| 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 | |
|---|
| 12 | 8 | #include <linux/kobject.h> |
|---|
| .. | .. |
|---|
| 92 | 88 | const char *buf, |
|---|
| 93 | 89 | size_t count) |
|---|
| 94 | 90 | { |
|---|
| 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 | + } |
|---|
| 98 | 99 | return count; |
|---|
| 99 | 100 | } |
|---|
| 100 | 101 | |
|---|