diff options
Diffstat (limited to 'drivers/hid/hid-picolcd_debugfs.c')
-rw-r--r-- | drivers/hid/hid-picolcd_debugfs.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/hid/hid-picolcd_debugfs.c b/drivers/hid/hid-picolcd_debugfs.c index 59ab8e157e6b..024cdf3c2297 100644 --- a/drivers/hid/hid-picolcd_debugfs.c +++ b/drivers/hid/hid-picolcd_debugfs.c | |||
@@ -394,7 +394,7 @@ static void dump_buff_as_hex(char *dst, size_t dst_sz, const u8 *data, | |||
394 | void picolcd_debug_out_report(struct picolcd_data *data, | 394 | void picolcd_debug_out_report(struct picolcd_data *data, |
395 | struct hid_device *hdev, struct hid_report *report) | 395 | struct hid_device *hdev, struct hid_report *report) |
396 | { | 396 | { |
397 | u8 raw_data[70]; | 397 | u8 *raw_data; |
398 | int raw_size = (report->size >> 3) + 1; | 398 | int raw_size = (report->size >> 3) + 1; |
399 | char *buff; | 399 | char *buff; |
400 | #define BUFF_SZ 256 | 400 | #define BUFF_SZ 256 |
@@ -407,20 +407,20 @@ void picolcd_debug_out_report(struct picolcd_data *data, | |||
407 | if (!buff) | 407 | if (!buff) |
408 | return; | 408 | return; |
409 | 409 | ||
410 | snprintf(buff, BUFF_SZ, "\nout report %d (size %d) = ", | 410 | raw_data = hid_alloc_report_buf(report, GFP_ATOMIC); |
411 | report->id, raw_size); | 411 | if (!raw_data) { |
412 | hid_debug_event(hdev, buff); | ||
413 | if (raw_size + 5 > sizeof(raw_data)) { | ||
414 | kfree(buff); | 412 | kfree(buff); |
415 | hid_debug_event(hdev, " TOO BIG\n"); | ||
416 | return; | 413 | return; |
417 | } else { | ||
418 | raw_data[0] = report->id; | ||
419 | hid_output_report(report, raw_data); | ||
420 | dump_buff_as_hex(buff, BUFF_SZ, raw_data, raw_size); | ||
421 | hid_debug_event(hdev, buff); | ||
422 | } | 414 | } |
423 | 415 | ||
416 | snprintf(buff, BUFF_SZ, "\nout report %d (size %d) = ", | ||
417 | report->id, raw_size); | ||
418 | hid_debug_event(hdev, buff); | ||
419 | raw_data[0] = report->id; | ||
420 | hid_output_report(report, raw_data); | ||
421 | dump_buff_as_hex(buff, BUFF_SZ, raw_data, raw_size); | ||
422 | hid_debug_event(hdev, buff); | ||
423 | |||
424 | switch (report->id) { | 424 | switch (report->id) { |
425 | case REPORT_LED_STATE: | 425 | case REPORT_LED_STATE: |
426 | /* 1 data byte with GPO state */ | 426 | /* 1 data byte with GPO state */ |
@@ -644,6 +644,7 @@ void picolcd_debug_out_report(struct picolcd_data *data, | |||
644 | break; | 644 | break; |
645 | } | 645 | } |
646 | wake_up_interruptible(&hdev->debug_wait); | 646 | wake_up_interruptible(&hdev->debug_wait); |
647 | kfree(raw_data); | ||
647 | kfree(buff); | 648 | kfree(buff); |
648 | } | 649 | } |
649 | 650 | ||