The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ashton Warner <drflamemontgomery@gmail.com>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Input: joydev - replace ev_match boolean with goto for early exit
Date: Thu, 9 Jul 2026 16:18:49 +1200	[thread overview]
Message-ID: <ak8hKSa9HNYPoOZZ@thesun> (raw)

The joydev_dev_is_absolute_mouse runs unnecessary Event type checks to
determine whether a joydev device is an absolute mouse. Change ev_match
to a goto statement to exit early.

Signed-off-by: Ashton Warner <drflamemontgomery@gmail.com>
---
 drivers/input/joydev.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 32459fd8a7c1..a726ba0be05b 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -819,7 +819,6 @@ static bool joydev_dev_is_blacklisted(struct input_dev *dev)
 static bool joydev_dev_is_absolute_mouse(struct input_dev *dev)
 {
 	DECLARE_BITMAP(jd_scratch, KEY_CNT);
-	bool ev_match = false;
 
 	BUILD_BUG_ON(ABS_CNT > KEY_CNT || EV_CNT > KEY_CNT);
 
@@ -855,20 +854,21 @@ static bool joydev_dev_is_absolute_mouse(struct input_dev *dev)
 	__set_bit(EV_KEY, jd_scratch);
 	__set_bit(EV_SYN, jd_scratch);
 	if (bitmap_equal(jd_scratch, dev->evbit, EV_CNT))
-		ev_match = true;
+		goto ev_match_pass;
 
 	/* HP ILO2, AMI BMC firmware */
 	__set_bit(EV_MSC, jd_scratch);
 	if (bitmap_equal(jd_scratch, dev->evbit, EV_CNT))
-		ev_match = true;
+		goto ev_match_pass;
 
 	/* VMware Virtual USB Mouse, QEMU USB Tablet, ATEN BMC firmware */
 	__set_bit(EV_REL, jd_scratch);
 	if (bitmap_equal(jd_scratch, dev->evbit, EV_CNT))
-		ev_match = true;
+		goto ev_match_pass;
 
-	if (!ev_match)
-		return false;
+	return false;
+
+ev_match_pass:
 
 	bitmap_zero(jd_scratch, ABS_CNT);
 	__set_bit(ABS_X, jd_scratch);
-- 
2.55.0


             reply	other threads:[~2026-07-09  4:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  4:18 Ashton Warner [this message]
2026-07-11 22:47 ` [PATCH] Input: joydev - replace ev_match boolean with goto for early exit Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ak8hKSa9HNYPoOZZ@thesun \
    --to=drflamemontgomery@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox