diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-10-23 14:24:12 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-10-28 15:12:45 +0300 |
commit | 063a3d67693ecde7f24ca00d4a131883edab1e73 (patch) | |
tree | 721c2298382f53a2d159cee21a512fac00baab63 /drivers/usb | |
parent | 3650b228f83adda7e5ee532e2b90429c03f7b9ec (diff) | |
download | linux-063a3d67693ecde7f24ca00d4a131883edab1e73.tar.xz |
usb: typec: stusb160x: fix some signedness bugs
These variables are enums but in this situation GCC will treat them as
unsigned so the conditions are never true.
Fixes: da0cb6310094 ("usb: typec: add support for STUSB160x Type-C controller family")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20201023112412.GD282278@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/typec/stusb160x.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c index ce0bd7b3ad88..7143852ce94d 100644 --- a/drivers/usb/typec/stusb160x.c +++ b/drivers/usb/typec/stusb160x.c @@ -545,7 +545,7 @@ static int stusb160x_get_fw_caps(struct stusb160x *chip, ret = fwnode_property_read_string(fwnode, "power-role", &cap_str); if (!ret) { chip->port_type = typec_find_port_power_role(cap_str); - if (chip->port_type < 0) { + if ((int)chip->port_type < 0) { ret = chip->port_type; return ret; } @@ -567,9 +567,10 @@ static int stusb160x_get_fw_caps(struct stusb160x *chip, if (!ret) { chip->pwr_opmode = typec_find_pwr_opmode(cap_str); /* Power delivery not yet supported */ - if (chip->pwr_opmode < 0 || + if ((int)chip->pwr_opmode < 0 || chip->pwr_opmode == TYPEC_PWR_MODE_PD) { - ret = chip->pwr_opmode < 0 ? chip->pwr_opmode : -EINVAL; + ret = (int)chip->pwr_opmode < 0 ? chip->pwr_opmode : + -EINVAL; dev_err(chip->dev, "bad power operation mode: %d\n", chip->pwr_opmode); return ret; |