@@ -1994,14 +1994,16 @@ static int alps_poll(struct psmouse *psmouse)
unsigned char buf[sizeof(psmouse->packet)];
bool poll_failed;
- if (priv->flags & ALPS_PASS)
- alps_passthrough_mode_v2(psmouse, true);
+ if ((priv->flags & ALPS_PASS) &&
+ alps_passthrough_mode_v2(psmouse, true))
+ return -1;
poll_failed = ps2_command(&psmouse->ps2dev, buf,
PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0;
- if (priv->flags & ALPS_PASS)
- alps_passthrough_mode_v2(psmouse, false);
+ if ((priv->flags & ALPS_PASS) &&
+ alps_passthrough_mode_v2(psmouse, false))
+ return -1;
if (poll_failed || (buf[0] & priv->mask0) != priv->byte0)
return -1;
Add error handling to propagate alps_passthrough_mode_v2() failures to the caller. When alps_passthrough_mode_v2() fails, immediately return -1 to stop further processing and maintain consistent error reporting. Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> --- drivers/input/mouse/alps.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)