summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2024-06-28 15:47:25 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2024-07-03 13:48:53 -0700
commit8bccf667f62a2351fd0b2a2fe5ba90806702c048 (patch)
treed8ac182e78911c4ff03822adbf5776061badfdc7 /drivers/input
parente8688b93ce00230614406d189e8286315832469a (diff)
Input: cypress_ps2 - report timeouts when reading command status
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. Link: https://lore.kernel.org/r/20240628224728.2180126-3-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/cypress_ps2.c9
1 files 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);