aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-input.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r--drivers/hid/hid-input.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 945b8158ec4c..7480799e535c 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -354,10 +354,10 @@ static int hidinput_get_battery_property(struct power_supply *psy,
354 dev->battery_report_type); 354 dev->battery_report_type);
355 355
356 if (ret != 2) { 356 if (ret != 2) {
357 if (ret >= 0) 357 ret = -ENODATA;
358 ret = -EINVAL;
359 break; 358 break;
360 } 359 }
360 ret = 0;
361 361
362 if (dev->battery_min < dev->battery_max && 362 if (dev->battery_min < dev->battery_max &&
363 buf[1] >= dev->battery_min && 363 buf[1] >= dev->battery_min &&
@@ -1042,9 +1042,14 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
1042 1042
1043 /* 1043 /*
1044 * Ignore out-of-range values as per HID specification, 1044 * Ignore out-of-range values as per HID specification,
1045 * section 5.10 and 6.2.25 1045 * section 5.10 and 6.2.25.
1046 *
1047 * The logical_minimum < logical_maximum check is done so that we
1048 * don't unintentionally discard values sent by devices which
1049 * don't specify logical min and max.
1046 */ 1050 */
1047 if ((field->flags & HID_MAIN_ITEM_VARIABLE) && 1051 if ((field->flags & HID_MAIN_ITEM_VARIABLE) &&
1052 (field->logical_minimum < field->logical_maximum) &&
1048 (value < field->logical_minimum || 1053 (value < field->logical_minimum ||
1049 value > field->logical_maximum)) { 1054 value > field->logical_maximum)) {
1050 dbg_hid("Ignoring out-of-range value %x\n", value); 1055 dbg_hid("Ignoring out-of-range value %x\n", value);