From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] Input: cypress_ps2 - report timeouts when reading command status
Date: Fri, 28 Jun 2024 15:47:25 -0700 [thread overview]
Message-ID: <20240628224728.2180126-3-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20240628224728.2180126-1-dmitry.torokhov@gmail.com>
Report -ETIMEDOUT error code from cypress_ps2_read_cmd_status() when
device does not send enough data within the allotted time in response
to a command.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/mouse/cypress_ps2.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index fcc3921e49e0..8e17cd0bc437 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -115,9 +115,12 @@ static int cypress_ps2_read_cmd_status(struct psmouse *psmouse,
if (rc < 0)
goto out;
- wait_event_timeout(ps2dev->wait,
- (psmouse->pktcnt >= pktsize),
- msecs_to_jiffies(CYTP_CMD_TIMEOUT));
+ if (!wait_event_timeout(ps2dev->wait,
+ psmouse->pktcnt >= pktsize,
+ msecs_to_jiffies(CYTP_CMD_TIMEOUT))) {
+ rc = -ETIMEDOUT;
+ goto out;
+ }
memcpy(param, psmouse->packet, pktsize);
--
2.45.2.803.g4e1b14247a-goog
next prev parent reply other threads:[~2024-06-28 22:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 22:47 [PATCH 1/5] Input: cypress_ps2 - clean up setting reporting rate Dmitry Torokhov
2024-06-28 22:47 ` [PATCH 2/5] Input: cypress_ps2 - fix error handling when sending command fails Dmitry Torokhov
2024-06-28 22:47 ` Dmitry Torokhov [this message]
2024-06-28 22:47 ` [PATCH 4/5] Input: cypress_ps2 - propagate errors from lower layers Dmitry Torokhov
2024-06-28 22:47 ` [PATCH 5/5] Input: cypress_ps2 - use u8 when dealing with byte data 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=20240628224728.2180126-3-dmitry.torokhov@gmail.com \
--to=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;
as well as URLs for NNTP newsgroup(s).