summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-09-25 14:01:28 +0300
committerSebastian Reichel <sre@kernel.org>2020-01-14 01:26:14 +0100
commiteb368de6de32925c65a97c1e929a31cae2155aee (patch)
tree3fe792580977f94c7e304353fb6aa47a9841f08c /drivers/power
parenta60ec78d306c6548d4adbc7918b587a723c555cc (diff)
downloadlinux-stable-eb368de6de32925c65a97c1e929a31cae2155aee.tar.gz
linux-stable-eb368de6de32925c65a97c1e929a31cae2155aee.tar.bz2
linux-stable-eb368de6de32925c65a97c1e929a31cae2155aee.zip
power: supply: sbs-battery: Fix a signedness bug in sbs_get_battery_capacity()
The "mode" variable is an enum and in this context GCC treats it as an unsigned int so the error handling is never triggered. Fixes: 51d075660457 ("bq20z75: Add support for charge properties") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/sbs-battery.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index c01599ecb9c8..6acd242eed48 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -556,7 +556,7 @@ static int sbs_get_battery_capacity(struct i2c_client *client,
mode = CAPACITY_MODE_AMPS;
mode = sbs_set_capacity_mode(client, mode);
- if (mode < 0)
+ if ((int)mode < 0)
return mode;
ret = sbs_read_word_data(client, sbs_data[reg_offset].addr);