aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-core.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-03-18 07:09:53 -0400
committerJiri Kosina <jkosina@suse.cz>2010-03-18 07:09:53 -0400
commit1caea61eda5c4d446147aa0e712ba395bb6b81c3 (patch)
tree8f45a6db478fd24b43e5b2fbc3b58ecc69eaea62 /drivers/hid/hid-core.c
parenta85821fce2c100a6680511f9693b76f9717fbdee (diff)
HID: output event in debugfs even if hid_get_report() fails
if hid_get_report() fails for whatever reason, the raw output of the report doesn't make it into 'events' file in debugfs at all, because we leave hid_input_report() too soon. We want the report to be always present for debugging reasons. Move the code around, so that the event makes it to 'events' file all the time, even if we are going to discard the report. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r--drivers/hid/hid-core.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 368fbb0c4ca6..c49aaa21e1a7 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1096,20 +1096,11 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
1096 goto nomem; 1096 goto nomem;
1097 } 1097 }
1098 1098
1099 snprintf(buf, HID_DEBUG_BUFSIZE - 1,
1100 "\nreport (size %u) (%snumbered)\n", size, report_enum->numbered ? "" : "un");
1101 hid_debug_event(hid, buf);
1102
1103 report = hid_get_report(report_enum, data);
1104 if (!report) {
1105 kfree(buf);
1106 return -1;
1107 }
1108
1109 /* dump the report */ 1099 /* dump the report */
1110 snprintf(buf, HID_DEBUG_BUFSIZE - 1, 1100 snprintf(buf, HID_DEBUG_BUFSIZE - 1,
1111 "report %d (size %u) = ", report->id, size); 1101 "\nreport (size %u) (%snumbered) = ", size, report_enum->numbered ? "" : "un");
1112 hid_debug_event(hid, buf); 1102 hid_debug_event(hid, buf);
1103
1113 for (i = 0; i < size; i++) { 1104 for (i = 0; i < size; i++) {
1114 snprintf(buf, HID_DEBUG_BUFSIZE - 1, 1105 snprintf(buf, HID_DEBUG_BUFSIZE - 1,
1115 " %02x", data[i]); 1106 " %02x", data[i]);
@@ -1117,6 +1108,13 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
1117 } 1108 }
1118 hid_debug_event(hid, "\n"); 1109 hid_debug_event(hid, "\n");
1119 1110
1111 report = hid_get_report(report_enum, data);
1112
1113 if (!report) {
1114 kfree(buf);
1115 return -1;
1116 }
1117
1120 kfree(buf); 1118 kfree(buf);
1121 1119
1122nomem: 1120nomem: