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

* Re: [PATCH] fix handling bq27xxx_read result
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Pali Rohár @ 2015-09-28  8:57 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: linux-kernel, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS

[-- Attachment #1: Type: Text/Plain, Size: 1075 bytes --]

On Monday 28 September 2015 10:51:27 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>
> ---
>  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) {

Seems legal change, so

Acked-By: Pali Rohár <pali.rohar@gmail.com>

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] fix handling bq27xxx_read result
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2015-09-28 16:34 UTC (permalink / raw)
  To: Andrzej Hajda
  Cc: linux-kernel, Bartlomiej Zolnierkiewicz, Marek Szyprowski,
	Pali Rohár, Dmitry Eremin-Solenikov, David Woodhouse,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[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).