diff options
author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2021-04-15 20:52:32 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2021-05-26 12:36:46 +0200 |
commit | 3202f482417cefc0f8fad5aaba6eea00f68141a0 (patch) | |
tree | f0927476c81bf55c34429720e444dd512ba4d52a /drivers/hid/hid-sensor-custom.c | |
parent | HID: i2c-hid: Skip ELAN power-on command after reset (diff) | |
download | linux-3202f482417cefc0f8fad5aaba6eea00f68141a0.tar.xz linux-3202f482417cefc0f8fad5aaba6eea00f68141a0.zip |
HID: hid-sensor-custom: Process failure of sensor_hub_set_feature()
When user modifies a custom feature value and sensor_hub_set_feature()
fails, return error.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to '')
-rw-r--r-- | drivers/hid/hid-sensor-custom.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c index 2e6662173a79..32c2306e240d 100644 --- a/drivers/hid/hid-sensor-custom.c +++ b/drivers/hid/hid-sensor-custom.c @@ -387,7 +387,7 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr, struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev); int index, field_index, usage; char name[HID_CUSTOM_NAME_LENGTH]; - int value; + int value, ret; if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage, name) == 3) { @@ -403,8 +403,10 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr, report_id = sensor_inst->fields[field_index].attribute. report_id; - sensor_hub_set_feature(sensor_inst->hsdev, report_id, - index, sizeof(value), &value); + ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id, + index, sizeof(value), &value); + if (ret) + return ret; } else return -EINVAL; |