diff mbox

power: bq27xxx_battery: signedness bug in bq27xxx_battery_read_health()

Message ID 20150928091653.GA11367@mwanda (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Dan Carpenter Sept. 28, 2015, 9:16 a.m. UTC
We need flags to be signed for the error handling to work.

Fixes: 74aab849f342 ('power: bq27xxx_battery: Cleanup health checking')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

Comments

Andrew Davis Sept. 28, 2015, 3:08 p.m. UTC | #1
On 09/28/2015 04:16 AM, Dan Carpenter wrote:
> We need flags to be signed for the error handling to work.
>
> Fixes: 74aab849f342 ('power: bq27xxx_battery: Cleanup health checking')

This bug looks to have been added back in c91d36ea8116, either way the
fix itself is correct so,

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>

Acked-by: Andrew F. Davis <afd@ti.com>

> 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) {
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sebastian Reichel Sept. 28, 2015, 4:33 p.m. UTC | #2
Hi,

On Mon, Sep 28, 2015 at 12:16:53PM +0300, Dan Carpenter wrote:
> We need flags to be signed for the error handling to work.
> 
> Fixes: 74aab849f342 ('power: bq27xxx_battery: Cleanup health checking')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, Andrzej Hajda was slightly fast than you, so I merged his
patch instead. I merged some of your patch description into his
patch, though.

-- Sebastian
diff mbox

Patch

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) {