lkml.org 
[lkml]   [2020]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH -next] input/keyboard/qt1050: fix unsigned comparison with 0
Date
Fixes warning because num is u32 and can never be negtative

drivers/input/keyboard/qt1050.c:371:18: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
if (button.num < 0 || button.num > QT1050_MAX_KEYS - 1)

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: ChenTao <chentao107@huawei.com>
---
drivers/input/keyboard/qt1050.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/qt1050.c b/drivers/input/keyboard/qt1050.c
index 403060d05c3b..a9ac99f62e39 100644
--- a/drivers/input/keyboard/qt1050.c
+++ b/drivers/input/keyboard/qt1050.c
@@ -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);
--
2.22.0
\
 
 \ /
  Last update: 2020-05-06 13:07    [W:0.024 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site