.. | .. |
---|
60 | 60 | struct list_head *report_list = |
---|
61 | 61 | &hid->report_enum[HID_OUTPUT_REPORT].report_list; |
---|
62 | 62 | struct input_dev *dev; |
---|
63 | | - int field_count = 0; |
---|
64 | 63 | int error; |
---|
65 | 64 | int i, j; |
---|
66 | 65 | |
---|
.. | .. |
---|
86 | 85 | * ----------------------------------------- |
---|
87 | 86 | * Do init them with default value. |
---|
88 | 87 | */ |
---|
| 88 | + if (report->maxfield < 4) { |
---|
| 89 | + hid_err(hid, "not enough fields in the report: %d\n", |
---|
| 90 | + report->maxfield); |
---|
| 91 | + return -ENODEV; |
---|
| 92 | + } |
---|
89 | 93 | for (i = 0; i < report->maxfield; i++) { |
---|
| 94 | + if (report->field[i]->report_count < 1) { |
---|
| 95 | + hid_err(hid, "no values in the field\n"); |
---|
| 96 | + return -ENODEV; |
---|
| 97 | + } |
---|
90 | 98 | for (j = 0; j < report->field[i]->report_count; j++) { |
---|
91 | 99 | report->field[i]->value[j] = 0x00; |
---|
92 | | - field_count++; |
---|
93 | 100 | } |
---|
94 | | - } |
---|
95 | | - |
---|
96 | | - if (field_count < 4) { |
---|
97 | | - hid_err(hid, "not enough fields in the report: %d\n", |
---|
98 | | - field_count); |
---|
99 | | - return -ENODEV; |
---|
100 | 101 | } |
---|
101 | 102 | |
---|
102 | 103 | betopff = kzalloc(sizeof(*betopff), GFP_KERNEL); |
---|