linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix handling bq27xxx_read result
@ 2015-09-28  8:51 Andrzej Hajda
  2015-09-28  8:57 ` Pali Rohár
  2015-09-28 16:34 ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Andrzej Hajda @ 2015-09-28  8:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrzej Hajda, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	Pali Rohár, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS

The function can return negative value.

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

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/power/bq27xxx_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c
index 473aa2f..994c78d 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) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-28 16:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-28  8:51 [PATCH] fix handling bq27xxx_read result Andrzej Hajda
2015-09-28  8:57 ` Pali Rohár
2015-09-28 16:34 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).