Commit a7a1c6b3 authored by Abhijeet Dharmapurikar's avatar Abhijeet Dharmapurikar Committed by Bryan Huntsman
Browse files

power: pm8921-bms: fix division error



Arithmetic conversion rules states that a signed operand is converted
to unsigned if the other operand is unsigned.

The voltage across vsense is a signed int and it can be negative.
Dividing it by the battery sense resistor, an unsigned int,  was
resulting in a very large positive number instead of a negative number.

Fix it by casting the battery sense resistor to signed so that a
a signed division is performed.

Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent f0b51cd8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment