Skip to content
Commit 12c0204b authored by Martin Calsyn's avatar Martin Calsyn Committed by Fabio Baltieri
Browse files

drivers: fuel_gauge: max17048: Fix overflow when calculating voltage



Annotate the calculation with type casts to force
promotion to uint32_t and then cast back down
to uint16_t for the return. This solves the issue
with invalid voltage (mV) values being returned
due to overflow during the conversion from the
register value on the max17048 chip.

Signed-off-by: default avatarMartin Calsyn <martin.calsyn@outcomex.com.au>
parent 49d4ad93
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment