From: Brian Norris <computersforpeace@gmail.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Brian Norris <computersforpeace@gmail.com>,
<linux-kernel@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Roger Quadros <rogerq@ti.com>,
"Ivan T . Ivanov" <ivan.ivanov@linaro.org>
Subject: [PATCH] extcon: fix signedness issues
Date: Mon, 10 Aug 2015 11:39:40 -0700 [thread overview]
Message-ID: <1439231980-105388-1-git-send-email-computersforpeace@gmail.com> (raw)
commit be052cc87745 ("extcon: Fix hang and
extcon_get/set_cable_state().") introduced several signedness issues.
sparse reports them:
drivers/extcon/extcon.c: In function ‘find_cable_index_by_name’:
drivers/extcon/extcon.c:153:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
drivers/extcon/extcon.c: In function ‘extcon_get_cable_state’:
drivers/extcon/extcon.c:384:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
drivers/extcon/extcon.c: In function ‘extcon_set_cable_state’:
drivers/extcon/extcon.c:432:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
Fixes: be052cc87745 ("extcon: Fix hang and extcon_get/set_cable_state().")
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
This is *only* compile-tested
drivers/extcon/extcon.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 43b57b02d050..a394ca419715 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -126,7 +126,7 @@ static int find_cable_index_by_id(struct extcon_dev *edev, const unsigned int id
static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
{
- unsigned int id = -EINVAL;
+ int id = -EINVAL;
int i = 0;
/* Find the id of extcon cable */
@@ -143,7 +143,7 @@ static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
{
- unsigned int id;
+ int id;
if (edev->max_supported == 0)
return -EINVAL;
@@ -378,7 +378,7 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
*/
int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name)
{
- unsigned int id;
+ int id;
id = find_cable_id_by_name(edev, cable_name);
if (id < 0)
@@ -426,7 +426,7 @@ EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
int extcon_set_cable_state(struct extcon_dev *edev,
const char *cable_name, bool cable_state)
{
- unsigned int id;
+ int id;
id = find_cable_id_by_name(edev, cable_name);
if (id < 0)
--
2.5.0.rc2.392.g76e840b
next reply other threads:[~2015-08-10 18:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-10 18:39 Brian Norris [this message]
2015-08-11 6:56 ` [PATCH] extcon: fix signedness issues Chanwoo Choi
2015-08-12 22:57 ` Brian Norris
2015-08-13 0:44 ` Chanwoo Choi
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=1439231980-105388-1-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=cw00.choi@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=ivan.ivanov@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=rogerq@ti.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox