From: Wentao Liang <vulab@iscas.ac.cn>
To: pali@kernel.org, dmitry.torokhov@gmail.com
Cc: erick.archer@outlook.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, Wentao Liang <vulab@iscas.ac.cn>
Subject: [PATCH] Input: alps - Propagate alps_passthrough_mode_v2() errors in alps_poll()
Date: Mon, 3 Mar 2025 19:07:31 +0800 [thread overview]
Message-ID: <20250303110731.1491-1-vulab@iscas.ac.cn> (raw)
Add error handling to propagate alps_passthrough_mode_v2() failures
to the caller. When alps_passthrough_mode_v2() fails, immediately
return -1 to stop further processing and maintain consistent error
reporting.
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/input/mouse/alps.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 0728b5c08f02..557de3d0fce6 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1994,14 +1994,16 @@ static int alps_poll(struct psmouse *psmouse)
unsigned char buf[sizeof(psmouse->packet)];
bool poll_failed;
- if (priv->flags & ALPS_PASS)
- alps_passthrough_mode_v2(psmouse, true);
+ if ((priv->flags & ALPS_PASS) &&
+ alps_passthrough_mode_v2(psmouse, true))
+ return -1;
poll_failed = ps2_command(&psmouse->ps2dev, buf,
PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0;
- if (priv->flags & ALPS_PASS)
- alps_passthrough_mode_v2(psmouse, false);
+ if ((priv->flags & ALPS_PASS) &&
+ alps_passthrough_mode_v2(psmouse, false))
+ return -1;
if (poll_failed || (buf[0] & priv->mask0) != priv->byte0)
return -1;
--
2.42.0.windows.2
next reply other threads:[~2025-03-03 11:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 11:07 Wentao Liang [this message]
2025-03-07 17:54 ` [PATCH] Input: alps - Propagate alps_passthrough_mode_v2() errors in alps_poll() Markus Elfring
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=20250303110731.1491-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=dmitry.torokhov@gmail.com \
--cc=erick.archer@outlook.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pali@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;
as well as URLs for NNTP newsgroup(s).