HID: uclogic: Skip non-input raw events earlier
authorNikolai Kondrashov <spbnick@gmail.com>
Thu, 10 Feb 2022 19:04:36 +0000 (20:04 +0100)
committerJiri Kosina <jkosina@suse.cz>
Wed, 16 Feb 2022 15:41:54 +0000 (16:41 +0100)
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>
drivers/hid/hid-uclogic-core.c

index 56b76d9b46afe65af59101f426d902004c555abf..8aac3f7a9cda405adbb17d2c1874cee39e99ee4c 100644 (file)
@@ -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 */
@@ -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;