aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r--drivers/hid/hid-core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 1e1a7770a6b9..38db8321b211 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -880,6 +880,10 @@ static void hid_output_field(struct hid_field *field, __u8 *data)
880 unsigned size = field->report_size; 880 unsigned size = field->report_size;
881 unsigned n; 881 unsigned n;
882 882
883 /* make sure the unused bits in the last byte are zeros */
884 if (count > 0 && size > 0)
885 data[(count*size-1)/8] = 0;
886
883 for (n = 0; n < count; n++) { 887 for (n = 0; n < count; n++) {
884 if (field->logical_minimum < 0) /* signed values */ 888 if (field->logical_minimum < 0) /* signed values */
885 implement(data, offset + n * size, size, s32ton(field->value[n], size)); 889 implement(data, offset + n * size, size, s32ton(field->value[n], size));