aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2018-12-05 06:27:44 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-06 10:07:43 -0500
commitdf44b479654f62b478c18ee4d8bc4e9f897a9844 (patch)
tree2c028dc441857a753c6341bacbb86b9a6e9a5e07 /drivers/base/core.c
parentc37d721c68ad88925ba0e72f6e14acb829a8c6bb (diff)
kobject: return error code if writing /sys/.../uevent fails
Propagate error code back to userspace if writing the /sys/.../uevent file fails. Before, the write operation always returned with success, even if we failed to recognize the input string or if we failed to generate the uevent itself. With the error codes properly propagated back to userspace, we are able to react in userspace accordingly by not assuming and awaiting a uevent that is not delivered. Signed-off-by: Peter Rajnoha <prajnoha@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index e2285059161d..a4ced331bc50 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1073,8 +1073,14 @@ out:
1073static ssize_t uevent_store(struct device *dev, struct device_attribute *attr, 1073static ssize_t uevent_store(struct device *dev, struct device_attribute *attr,
1074 const char *buf, size_t count) 1074 const char *buf, size_t count)
1075{ 1075{
1076 if (kobject_synth_uevent(&dev->kobj, buf, count)) 1076 int rc;
1077
1078 rc = kobject_synth_uevent(&dev->kobj, buf, count);
1079
1080 if (rc) {
1077 dev_err(dev, "uevent: failed to send synthetic uevent\n"); 1081 dev_err(dev, "uevent: failed to send synthetic uevent\n");
1082 return rc;
1083 }
1078 1084
1079 return count; 1085 return count;
1080} 1086}