All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: touchscreen: sur40: fix bad endianness handling in sur40_poll
@ 2017-04-04 13:06 Martin Kepplinger
  2017-04-04 17:07 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Kepplinger @ 2017-04-04 13:06 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: hverkuil, mchehab, linux-input, linux-kernel, Martin Kepplinger

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>
---
 drivers/input/touchscreen/sur40.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index 4c0eeca..128e5bd 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -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);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] input: touchscreen: sur40: fix bad endianness handling in sur40_poll
  2017-04-04 13:06 [PATCH] input: touchscreen: sur40: fix bad endianness handling in sur40_poll Martin Kepplinger
@ 2017-04-04 17:07 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2017-04-04 17:07 UTC (permalink / raw)
  To: Martin Kepplinger; +Cc: hverkuil, mchehab, linux-input, linux-kernel

On Tue, Apr 04, 2017 at 03:06:17PM +0200, Martin Kepplinger wrote:
> 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>

Applied, thank you.

> ---
>  drivers/input/touchscreen/sur40.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
> index 4c0eeca..128e5bd 100644
> --- a/drivers/input/touchscreen/sur40.c
> +++ b/drivers/input/touchscreen/sur40.c
> @@ -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);
> -- 
> 2.1.4
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-04 17:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 13:06 [PATCH] input: touchscreen: sur40: fix bad endianness handling in sur40_poll Martin Kepplinger
2017-04-04 17:07 ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.