提交 2edd69a8 编写于 作者: A Andrzej Hajda 提交者: Sebastian Reichel

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: 74aab849 ('power: bq27xxx_battery: Cleanup health checking')
Signed-off-by: NAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-By: NPali Rohár <pali.rohar@gmail.com>
Acked-by: NAndrew F. Davis <afd@ti.com>
Signed-off-by: NSebastian Reichel <sre@kernel.org>
上级 2202e1fc
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册