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@xxxxxxxxxxx> --- drivers/input/mouse/alps.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 0728b5c08f02..557de3d0fce6 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -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; -- 2.42.0.windows.2