All of lore.kernel.org
 help / color / mirror / Atom feed
From: ChenTao <chentao107@huawei.com>
To: <dmitry.torokhov@gmail.com>
Cc: <robh@kernel.org>, <m.felsch@pengutronix.de>,
	<linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<chentao107@huawei.com>
Subject: [PATCH -next] input/keyboard/qt1050: fix unsigned comparison with 0
Date: Wed, 6 May 2020 19:04:45 +0800	[thread overview]
Message-ID: <20200506110445.111576-1-chentao107@huawei.com> (raw)

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


                 reply	other threads:[~2020-05-06 11:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200506110445.111576-1-chentao107@huawei.com \
    --to=chentao107@huawei.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.