Skip to content

Commit

Permalink
HID: uclogic: Skip non-input raw events earlier
Browse files Browse the repository at this point in the history
Early return when a non-input raw event is received to simplify the
logic present in uclogic_raw_event.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Nikolai Kondrashov authored and Jiri Kosina committed Feb 16, 2022
1 parent 7f12dd2 commit fea53b9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/hid/hid-uclogic-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,12 @@ static int uclogic_raw_event(struct hid_device *hdev,
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
struct uclogic_params *params = &drvdata->params;

/* Do not handle anything but input reports */
if (report->type != HID_INPUT_REPORT)
return 0;

/* Tweak pen reports, if necessary */
if (!params->pen_unused &&
(report->type == HID_INPUT_REPORT) &&
(report->id == params->pen.id) &&
(size >= 2)) {
/* If it's the "virtual" frame controls report */
Expand All @@ -384,8 +387,7 @@ static int uclogic_raw_event(struct hid_device *hdev,
}

/* Tweak frame control reports, if necessary */
if ((report->type == HID_INPUT_REPORT) &&
(report->id == params->frame.id))
if (report->id == params->frame.id)
return uclogic_raw_event_frame(drvdata, data, size);

return 0;
Expand Down

0 comments on commit fea53b9

Please sign in to comment.