mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
ca66a6770b
commit
3202f48241
|
@ -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);
|
struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
|
||||||
int index, field_index, usage;
|
int index, field_index, usage;
|
||||||
char name[HID_CUSTOM_NAME_LENGTH];
|
char name[HID_CUSTOM_NAME_LENGTH];
|
||||||
int value;
|
int value, ret;
|
||||||
|
|
||||||
if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
|
if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
|
||||||
name) == 3) {
|
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_inst->fields[field_index].attribute.
|
||||||
report_id;
|
report_id;
|
||||||
sensor_hub_set_feature(sensor_inst->hsdev, report_id,
|
ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
|
||||||
index, sizeof(value), &value);
|
index, sizeof(value), &value);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
} else
|
} else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue