Thread (9 messages) 9 messages, 2 authors, 2022-02-16
STALE1563d

[PATCH 6/7] HID: uclogic: Skip non-input raw events earlier

From: José Expósito <hidden>
Date: 2022-02-10 19:05:10
Also in: lkml
Subsystem: hid core layer, the rest · Maintainers: Jiri Kosina, Benjamin Tissoires, Linus Torvalds

From: Nikolai Kondrashov <redacted>

Early return when a non-input raw event is received to simplify the
logic present in uclogic_raw_event.

Signed-off-by: Nikolai Kondrashov <redacted>
Signed-off-by: José Expósito <redacted>
---
 drivers/hid/hid-uclogic-core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index 56b76d9b46af..8aac3f7a9cda 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -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;
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help