mirror of
https://github.com/torvalds/linux
synced 2024-09-22 12:26:27 +00:00
HID: simplify error handling in hid_input_report()
The handling of failed debugging buffer allocation got overly complicated. We simply want to skip the debugging code if allocation fails and go on with event processing. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
1caea61eda
commit
f77e347bd4
|
@ -1091,10 +1091,8 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
|
||||||
|
|
||||||
buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);
|
buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);
|
||||||
|
|
||||||
if (!buf) {
|
if (!buf)
|
||||||
report = hid_get_report(report_enum, data);
|
|
||||||
goto nomem;
|
goto nomem;
|
||||||
}
|
|
||||||
|
|
||||||
/* dump the report */
|
/* dump the report */
|
||||||
snprintf(buf, HID_DEBUG_BUFSIZE - 1,
|
snprintf(buf, HID_DEBUG_BUFSIZE - 1,
|
||||||
|
@ -1107,17 +1105,14 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
|
||||||
hid_debug_event(hid, buf);
|
hid_debug_event(hid, buf);
|
||||||
}
|
}
|
||||||
hid_debug_event(hid, "\n");
|
hid_debug_event(hid, "\n");
|
||||||
|
|
||||||
report = hid_get_report(report_enum, data);
|
|
||||||
|
|
||||||
if (!report) {
|
|
||||||
kfree(buf);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
|
|
||||||
nomem:
|
nomem:
|
||||||
|
report = hid_get_report(report_enum, data);
|
||||||
|
|
||||||
|
if (!report)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
|
if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
|
||||||
ret = hdrv->raw_event(hid, report, data, size);
|
ret = hdrv->raw_event(hid, report, data, size);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
|
|
Loading…
Reference in a new issue