diff options
Diffstat (limited to 'net/bluetooth/hidp/core.c')
-rw-r--r-- | net/bluetooth/hidp/core.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 0c699cdc3696..d38ab1527006 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -225,17 +225,22 @@ static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb) | |||
225 | 225 | ||
226 | static int hidp_send_report(struct hidp_session *session, struct hid_report *report) | 226 | static int hidp_send_report(struct hidp_session *session, struct hid_report *report) |
227 | { | 227 | { |
228 | unsigned char buf[32], hdr; | 228 | unsigned char hdr; |
229 | int rsize; | 229 | u8 *buf; |
230 | int rsize, ret; | ||
230 | 231 | ||
231 | rsize = ((report->size - 1) >> 3) + 1 + (report->id > 0); | 232 | buf = hid_alloc_report_buf(report, GFP_ATOMIC); |
232 | if (rsize > sizeof(buf)) | 233 | if (!buf) |
233 | return -EIO; | 234 | return -EIO; |
234 | 235 | ||
235 | hid_output_report(report, buf); | 236 | hid_output_report(report, buf); |
236 | hdr = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT; | 237 | hdr = HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT; |
237 | 238 | ||
238 | return hidp_send_intr_message(session, hdr, buf, rsize); | 239 | rsize = ((report->size - 1) >> 3) + 1 + (report->id > 0); |
240 | ret = hidp_send_intr_message(session, hdr, buf, rsize); | ||
241 | |||
242 | kfree(buf); | ||
243 | return ret; | ||
239 | } | 244 | } |
240 | 245 | ||
241 | static int hidp_get_raw_report(struct hid_device *hid, | 246 | static int hidp_get_raw_report(struct hid_device *hid, |