Message ID | 20250303110731.1491-1-vulab@iscas.ac.cn (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Input: alps - Propagate alps_passthrough_mode_v2() errors in alps_poll() | expand |
> 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. How do you think about to add any tags (like “Fixes” and “Cc”) accordingly? https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.14-rc5#n145 Regards, Markus
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;
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(-)