Commit eb368de6 authored by Dan Carpenter's avatar Dan Carpenter Committed by Sebastian Reichel

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: 51d07566 ("bq20z75: Add support for charge properties")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent a60ec78d
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment