From: Dmitry Torokhov Date: Fri, 28 Jun 2024 22:47:25 +0000 (-0700) Subject: Input: cypress_ps2 - report timeouts when reading command status X-Git-Tag: v6.11-rc1~98^2^2~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8bccf667f62a;p=thirdparty%2Flinux.git 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 --- diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c index fcc3921e49e0f..8e17cd0bc437d 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);