Input: alps - fix a mismatch between a condition check and its comment
authorHui Wang <hui.wang@canonical.com>
Fri, 19 Jul 2019 09:38:58 +0000 (12:38 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:22 +0000 (09:14 +0200)
commit8da63aa46e2685db6834cbe91dd7a1a4d04b5db9
tree000d86d60dc5ef29eb9c3e4e5e5a484b81c12898
parent81368a9a98d9f3b92f31baa28fc5e1c4e805d664
Input: alps - fix a mismatch between a condition check and its comment

commit 771a081e44a9baa1991ef011cc453ef425591740 upstream.

In the function alps_is_cs19_trackpoint(), we check if the param[1] is
in the 0x20~0x2f range, but the code we wrote for this checking is not
correct:
(param[1] & 0x20) does not mean param[1] is in the range of 0x20~0x2f,
it also means the param[1] is in the range of 0x30~0x3f, 0x60~0x6f...

Now fix it with a new condition checking ((param[1] & 0xf0) == 0x20).

Fixes: 7e4935ccc323 ("Input: alps - don't handle ALPS cs19 trackpoint-only device")
Cc: stable@vger.kernel.org
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/input/mouse/alps.c