mbox series

[v2,0/2] fix an overflow error on sc27xx power supply

Message ID 20200724122148.26541-1-zhang.lyra@gmail.com (mailing list archive)
Headers show
Series fix an overflow error on sc27xx power supply | expand

Message

Chunyan Zhang July 24, 2020, 12:21 p.m. UTC
From: Chunyan Zhang <chunyan.zhang@unisoc.com>

The patch 2/2 fixes an overflow error by changing to 64-bit divide operations.
In order to avoid compile error on 32-bit architectures, this patchset
also introduced a new 64-bit helper in patch 1/2.

Changes since v1: (https://lkml.org/lkml/2020/7/17/63)
- Added new help macro DIV_S64_ROUND_CLOSEST;
- Fixed an error reported by kernel test robot <lkp@intel.com>.

Chunyan Zhang (2):
  math64: New DIV_S64_ROUND_CLOSEST helper
  power: supply: sc27xx: prevent adc * 1000 from overflow

 drivers/power/supply/sc27xx_fuel_gauge.c |  9 +++++----
 include/linux/math64.h                   | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

Comments

Sebastian Reichel July 27, 2020, 11:14 p.m. UTC | #1
Hi,

On Fri, Jul 24, 2020 at 08:21:46PM +0800, Chunyan Zhang wrote:
> From: Chunyan Zhang <chunyan.zhang@unisoc.com>
> 
> The patch 2/2 fixes an overflow error by changing to 64-bit divide operations.
> In order to avoid compile error on 32-bit architectures, this patchset
> also introduced a new 64-bit helper in patch 1/2.
> 
> Changes since v1: (https://lkml.org/lkml/2020/7/17/63)
> - Added new help macro DIV_S64_ROUND_CLOSEST;
> - Fixed an error reported by kernel test robot <lkp@intel.com>.
> 
> Chunyan Zhang (2):
>   math64: New DIV_S64_ROUND_CLOSEST helper
>   power: supply: sc27xx: prevent adc * 1000 from overflow
> 
>  drivers/power/supply/sc27xx_fuel_gauge.c |  9 +++++----
>  include/linux/math64.h                   | 19 +++++++++++++++++++
>  2 files changed, 24 insertions(+), 4 deletions(-)

Thanks, queued.

-- Sebastian