From: Andrzej Hajda Date: Mon, 28 Sep 2015 08:51:27 +0000 (+0200) Subject: power: bq27xxx_battery: fix signedness bug in bq27xxx_battery_read_health() X-Git-Tag: firefly_0821_release~176^2~793^2~19 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2edd69a81dd4e8068bb512ffcc3959c77fc182ea;p=firefly-linux-kernel-4.4.55.git power: bq27xxx_battery: fix signedness bug in bq27xxx_battery_read_health() We need flags to be signed for the error handling to work. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Fixes: 74aab849f342 ('power: bq27xxx_battery: Cleanup health checking') Signed-off-by: Andrzej Hajda Signed-off-by: Dan Carpenter Acked-By: Pali Rohár Acked-by: Andrew F. Davis Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c index 473aa2f94882..994c78d9f426 100644 --- a/drivers/power/bq27xxx_battery.c +++ b/drivers/power/bq27xxx_battery.c @@ -691,7 +691,7 @@ static bool bq27xxx_battery_dead(struct bq27xxx_device_info *di, u16 flags) */ static int bq27xxx_battery_read_health(struct bq27xxx_device_info *di) { - u16 flags; + int flags; flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, false); if (flags < 0) {