Skip to content

Commit 8bccf66

Browse files
committed
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>
1 parent e8688b9 commit 8bccf66

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/input/mouse/cypress_ps2.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ static int cypress_ps2_read_cmd_status(struct psmouse *psmouse,
115115
if (rc < 0)
116116
goto out;
117117

118-
wait_event_timeout(ps2dev->wait,
119-
(psmouse->pktcnt >= pktsize),
120-
msecs_to_jiffies(CYTP_CMD_TIMEOUT));
118+
if (!wait_event_timeout(ps2dev->wait,
119+
psmouse->pktcnt >= pktsize,
120+
msecs_to_jiffies(CYTP_CMD_TIMEOUT))) {
121+
rc = -ETIMEDOUT;
122+
goto out;
123+
}
121124

122125
memcpy(param, psmouse->packet, pktsize);
123126

0 commit comments

Comments
 (0)