summaryrefslogtreecommitdiff
path: root/drivers/extcon/extcon.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-08-04 10:47:23 +0300
committerChanwoo Choi <cw00.choi@samsung.com>2015-08-10 11:48:57 +0900
commita598af7f0279195abffbfb9bf2070457e9c89ff3 (patch)
treef2ebc9053cd17f5e5618ac898bd751c80c7e6c65 /drivers/extcon/extcon.c
parentbef025a1f8e0e566f954613f4e5087f6b156e2a5 (diff)
extcon: Fix signedness bugs about break error handling
Unsigned is never less than zero so this error handling won't work. Fixes: be052cc87745 ('extcon: Fix hang and extcon_get/set_cable_state().') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Roger Quadros <rogerq@ti.com> [cw00.choi: Change the patch title and fix signedness bug of find_cable_index_by_id() ] Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon.c')
-rw-r--r--drivers/extcon/extcon.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 8301a72b1073..a07addde297b 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;
@@ -379,7 +379,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)
@@ -430,7 +430,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)