All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: synaptics-rmi4: Clean up redundant check
@ 2017-10-08 22:26 Christos Gkekas
  2017-10-09 17:39 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Christos Gkekas @ 2017-10-08 22:26 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input, linux-kernel; +Cc: Christos Gkekas

Variable size_presence_reg·is unsigned so checking whether it is less
than zero is redundant.

Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
---
 drivers/input/rmi4/rmi_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 4f2bb59..68fcb30 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -601,7 +601,7 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr,
 		return ret;
 	++addr;
 
-	if (size_presence_reg < 0 || size_presence_reg > 35)
+	if (size_presence_reg > 35)
 		return -EIO;
 
 	memset(buf, 0, sizeof(buf));
-- 
2.7.4

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

* Re: [PATCH] Input: synaptics-rmi4: Clean up redundant check
  2017-10-08 22:26 [PATCH] Input: synaptics-rmi4: Clean up redundant check Christos Gkekas
@ 2017-10-09 17:39 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2017-10-09 17:39 UTC (permalink / raw)
  To: Christos Gkekas; +Cc: linux-input, linux-kernel

On Sun, Oct 08, 2017 at 11:26:51PM +0100, Christos Gkekas wrote:
> Variable size_presence_reg·is unsigned so checking whether it is less
> than zero is redundant.
> 
> Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>

I'd rather we kept the check as it documents the valid range of values.

> ---
>  drivers/input/rmi4/rmi_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
> index 4f2bb59..68fcb30 100644
> --- a/drivers/input/rmi4/rmi_driver.c
> +++ b/drivers/input/rmi4/rmi_driver.c
> @@ -601,7 +601,7 @@ int rmi_read_register_desc(struct rmi_device *d, u16 addr,
>  		return ret;
>  	++addr;
>  
> -	if (size_presence_reg < 0 || size_presence_reg > 35)
> +	if (size_presence_reg > 35)
>  		return -EIO;
>  
>  	memset(buf, 0, sizeof(buf));
> -- 
> 2.7.4
> 

Thanks.

-- 
Dmitry

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

end of thread, other threads:[~2017-10-09 17:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08 22:26 [PATCH] Input: synaptics-rmi4: Clean up redundant check Christos Gkekas
2017-10-09 17:39 ` 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.