Commit 8bccf667 authored by Dmitry Torokhov's avatar Dmitry Torokhov

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.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent e8688b93
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment