Skip to content

Commit 3202f48

Browse files
spandruvadaJiri Kosina
authored andcommitted
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>
1 parent ca66a67 commit 3202f48

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/hid/hid-sensor-custom.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
387387
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
388388
int index, field_index, usage;
389389
char name[HID_CUSTOM_NAME_LENGTH];
390-
int value;
390+
int value, ret;
391391

392392
if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
393393
name) == 3) {
@@ -403,8 +403,10 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr,
403403

404404
report_id = sensor_inst->fields[field_index].attribute.
405405
report_id;
406-
sensor_hub_set_feature(sensor_inst->hsdev, report_id,
407-
index, sizeof(value), &value);
406+
ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
407+
index, sizeof(value), &value);
408+
if (ret)
409+
return ret;
408410
} else
409411
return -EINVAL;
410412

0 commit comments

Comments
 (0)