diff options
| -rw-r--r-- | drivers/hid/hid-core.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 10a2c0866459..da52279de939 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1253,7 +1253,8 @@ EXPORT_SYMBOL_GPL(hid_output_report); | |||
| 1253 | 1253 | ||
| 1254 | static int hid_report_len(struct hid_report *report) | 1254 | static int hid_report_len(struct hid_report *report) |
| 1255 | { | 1255 | { |
| 1256 | return ((report->size - 1) >> 3) + 1 + (report->id > 0) + 7; | 1256 | /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */ |
| 1257 | return ((report->size - 1) >> 3) + 1 + (report->id > 0); | ||
| 1257 | } | 1258 | } |
| 1258 | 1259 | ||
| 1259 | /* | 1260 | /* |
| @@ -1266,7 +1267,7 @@ u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags) | |||
| 1266 | * of implement() working on 8 byte chunks | 1267 | * of implement() working on 8 byte chunks |
| 1267 | */ | 1268 | */ |
| 1268 | 1269 | ||
| 1269 | int len = hid_report_len(report); | 1270 | int len = hid_report_len(report) + 7; |
| 1270 | 1271 | ||
| 1271 | return kmalloc(len, flags); | 1272 | return kmalloc(len, flags); |
| 1272 | } | 1273 | } |
