mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
iio: hid-sensor: fix return of -EINVAL on invalid values in ret or value
[ Upstream commitc894acc7bf] Ensure that when an invalid value in ret or value is found -EINVAL is returned. A previous commit broke the way the return error is being returned and instead caused the return code in ret to be re-assigned rather than be returned. Fixes:5d9854eaea("iio: hid-sensor: Store restore poll and hysteresis on S3") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0fff422f15
commit
3a0c4d9778
@@ -215,7 +215,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
|
||||
ret = sensor_hub_set_feature(st->hsdev, st->poll.report_id,
|
||||
st->poll.index, sizeof(value), &value);
|
||||
if (ret < 0 || value < 0)
|
||||
ret = -EINVAL;
|
||||
return -EINVAL;
|
||||
|
||||
ret = sensor_hub_get_feature(st->hsdev,
|
||||
st->poll.report_id,
|
||||
@@ -265,7 +265,7 @@ int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st,
|
||||
st->sensitivity.index, sizeof(value),
|
||||
&value);
|
||||
if (ret < 0 || value < 0)
|
||||
ret = -EINVAL;
|
||||
return -EINVAL;
|
||||
|
||||
ret = sensor_hub_get_feature(st->hsdev,
|
||||
st->sensitivity.report_id,
|
||||
|
||||
Reference in New Issue
Block a user