Input: sur40 - fix bad endianness handling in sur40_poll
authorMartin Kepplinger <martink@posteo.de>
Tue, 4 Apr 2017 17:06:57 +0000 (10:06 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 5 Apr 2017 15:52:36 +0000 (08:52 -0700)
sparse says:

  sur40.c:372:40: warning: restricted __le32 degrades to integer

the header's data is __le32 so we need to convert it before comparing.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/sur40.c

index 4c0eecae065c113a26400469d7def3c2b9bcc635..128e5bd747203b92b9eae68777d44b01b946fddc 100644 (file)
@@ -369,7 +369,7 @@ static void sur40_poll(struct input_polled_dev *polldev)
                 * packet ID will usually increase in the middle of a series
                 * instead of at the end.
                 */
-               if (packet_id != header->packet_id)
+               if (packet_id != le32_to_cpu(header->packet_id))
                        dev_dbg(sur40->dev, "packet ID mismatch\n");
 
                packet_blobs = result / sizeof(struct sur40_blob);