Skip to contentSkip to conversation

Input: synaptics-rmi4: Clean up redundant check

PATCH In review Christos Gkekas 2 participants 2 messages Oct 8, 2017 – Oct 9, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: synaptics-rmi4: Clean up redundant check

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

---
 drivers/input/rmi4/rmi_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/rmi4/rmi_driver.c +1 -1
index 4f2bb59..68fcb30 100644
@@ -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));
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 4 lines · Christos Gkekas

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

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

Quoted 20 lines
---
 drivers/input/rmi4/rmi_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/rmi4/rmi_driver.c +1 -1
index 4f2bb59..68fcb30 100644
@@ -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));
Signature · 1 line
2.7.4

Thanks.

Signature · 1 line
Dmitry