mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
extcon: Fix signedness bugs about break error handling
Unsigned is never less than zero so this error handling won't work.
Fixes: be052cc877 ('extcon: Fix hang and extcon_get/set_cable_state().')
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Roger Quadros <[email protected]>
[cw00.choi: Change the patch title and fix signedness bug of find_cable_index_by_id() ]
Signed-off-by: Chanwoo Choi <[email protected]>
This commit is contained in:
parent
bef025a1f8
commit
a598af7f02
1 changed files with 4 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue