Skip to content

Commit fea53b9

Browse files
spbnickJiri Kosina
authored andcommitted
HID: uclogic: Skip non-input raw events earlier
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>
1 parent 7f12dd2 commit fea53b9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/hid/hid-uclogic-core.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,12 @@ static int uclogic_raw_event(struct hid_device *hdev,
368368
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
369369
struct uclogic_params *params = &drvdata->params;
370370

371+
/* Do not handle anything but input reports */
372+
if (report->type != HID_INPUT_REPORT)
373+
return 0;
374+
371375
/* Tweak pen reports, if necessary */
372376
if (!params->pen_unused &&
373-
(report->type == HID_INPUT_REPORT) &&
374377
(report->id == params->pen.id) &&
375378
(size >= 2)) {
376379
/* If it's the "virtual" frame controls report */
@@ -384,8 +387,7 @@ static int uclogic_raw_event(struct hid_device *hdev,
384387
}
385388

386389
/* Tweak frame control reports, if necessary */
387-
if ((report->type == HID_INPUT_REPORT) &&
388-
(report->id == params->frame.id))
390+
if (report->id == params->frame.id)
389391
return uclogic_raw_event_frame(drvdata, data, size);
390392

391393
return 0;

0 commit comments

Comments
 (0)