diff mbox

Input: synaptics-rmi4: Clean up redundant check

Message ID 1507501611-16703-1-git-send-email-chris.gekas@gmail.com (mailing list archive)
State Rejected
Headers show

Commit Message

Christos Gkekas Oct. 8, 2017, 10:26 p.m. UTC
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(-)

Comments

Dmitry Torokhov Oct. 9, 2017, 5:39 p.m. UTC | #1
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.
diff mbox

Patch

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));