power: supply: sbs-battery: Fix a signedness bug in sbs_get_battery_capacity()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 25 Sep 2019 11:01:28 +0000 (14:01 +0300)
committerSebastian Reichel <sre@kernel.org>
Tue, 14 Jan 2020 00:26:14 +0000 (01:26 +0100)
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>
drivers/power/supply/sbs-battery.c

index c01599e..6acd242 100644 (file)
@@ -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);