diff mbox series

[4/7] Input: libps2 - fix NAK handling

Message ID 20230511185252.386941-5-dmitry.torokhov@gmail.com (mailing list archive)
State Mainlined
Commit 1db0fd245b6016c21097b5ae01aeb447484de951
Headers show
Series libps2: be more tolerant when processing commands | expand

Commit Message

Dmitry Torokhov May 11, 2023, 6:52 p.m. UTC
Do not try to process "resend" or "reject" responses from the device
as normal response data for a command.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/serio/libps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Raul Rangel May 18, 2023, 5:22 p.m. UTC | #1
On Thu, May 11, 2023 at 11:52:44AM -0700, Dmitry Torokhov wrote:
> Do not try to process "resend" or "reject" responses from the device
> as normal response data for a command.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/serio/libps2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
> index d09450eca9a7..14b70a78875d 100644
> --- a/drivers/input/serio/libps2.c
> +++ b/drivers/input/serio/libps2.c
> @@ -445,7 +445,7 @@ bool ps2_handle_ack(struct ps2dev *ps2dev, u8 data)
>  	ps2dev->flags &= ~PS2_FLAG_ACK;
>  	wake_up(&ps2dev->wait);
>  
> -	if (data != PS2_RET_ACK)
> +	if (!ps2dev->nak && data != PS2_RET_ACK)
>  		ps2_handle_response(ps2dev, data);
>  
>  	return true;
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
diff mbox series

Patch

diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
index d09450eca9a7..14b70a78875d 100644
--- a/drivers/input/serio/libps2.c
+++ b/drivers/input/serio/libps2.c
@@ -445,7 +445,7 @@  bool ps2_handle_ack(struct ps2dev *ps2dev, u8 data)
 	ps2dev->flags &= ~PS2_FLAG_ACK;
 	wake_up(&ps2dev->wait);
 
-	if (data != PS2_RET_ACK)
+	if (!ps2dev->nak && data != PS2_RET_ACK)
 		ps2_handle_response(ps2dev, data);
 
 	return true;