Re: [patch] ds2782_battery: signedness bug in ds278x_read_reg16()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 24, 2012 at 10:12:29AM +0300, Dan Carpenter wrote:
> We need to check for negative values before doing the swab16() for the
> error handling to work.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Applied, thanks!

> diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
> index 6bb6e2f..2fa9b6b 100644
> --- a/drivers/power/ds2782_battery.c
> +++ b/drivers/power/ds2782_battery.c
> @@ -80,13 +80,13 @@ static inline int ds278x_read_reg16(struct ds278x_info *info, int reg_msb,
>  {
>  	int ret;
>  
> -	ret = swab16(i2c_smbus_read_word_data(info->client, reg_msb));
> +	ret = i2c_smbus_read_word_data(info->client, reg_msb);
>  	if (ret < 0) {
>  		dev_err(&info->client->dev, "register read failed\n");
>  		return ret;
>  	}
>  
> -	*val = ret;
> +	*val = swab16(ret);
>  	return 0;
>  }
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux