Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1233954 > unrolled thread

[PATCH] fix handling bq27xxx_read result

Started byAndrzej Hajda <a.hajda@samsung.com>
First post2015-09-28 11:00 +0200
Last post2015-09-28 18:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] fix handling bq27xxx_read result Andrzej Hajda <a.hajda@samsung.com> - 2015-09-28 11:00 +0200
    Re: [PATCH] fix handling bq27xxx_read result Sebastian Reichel <sre@kernel.org> - 2015-09-28 18:40 +0200

#1233954 — [PATCH] fix handling bq27xxx_read result

FromAndrzej Hajda <a.hajda@samsung.com>
Date2015-09-28 11:00 +0200
Subject[PATCH] fix handling bq27xxx_read result
Message-ID<qdCrU-Qy-7@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1234281

FromSebastian Reichel <sre@kernel.org>
Date2015-09-28 18:40 +0200
Message-ID<qdJD3-4SO-5@gated-at.bofh.it>
In reply to#1233954

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Mon, Sep 28, 2015 at 10:51:27AM +0200, Andrzej Hajda wrote:
> 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>

Thanks, queued with some bits from Dan Carpenter's patch
description.

-- Sebastian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web