Skip to contentSkip to conversation

Input: qt1050 - remove unnecessary comparison of unsigned integer with < 0

PATCH New Gustavo A. R. Silva 1 participant 1 message May 27, 2019

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

PATCH 1/1 Input: qt1050 - remove unnecessary comparison of unsigned integer with < 0

There is no need to compare button.num with < 0 because such comparison of an unsigned value is always false.

Fix this by removing such comparison.

Addresses-Coverity-ID: 1445492 ("Unsigned compared against 0")

Fixes cbebf5addec1 ("Input: qt1050 - add Microchip AT42QT1050 support")
---
 drivers/input/keyboard/qt1050.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/qt1050.c +1 -1
index 403060d05c3b..a9ac99f62e39 100644
@@ -368,7 +368,7 @@ static int qt1050_parse_fw(struct qt1050_priv *ts)
 			dev_err(dev, "Button without pad number\n");
 			goto err;
 		}
-		if (button.num < 0 || button.num > QT1050_MAX_KEYS - 1)
+		if (button.num > QT1050_MAX_KEYS - 1)
 			goto err;
 
 		ts->reg_keys |= BIT(button.num);
Signature · 1 line
2.21.0