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: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
1 file changed