power: batterydata-lib: fix out of bound errors
If the battery data lookup tables are misconfigured, there can exist an
array index out of bound error when doing ocv or scaling factor
interpolation using the batterydata-lib functions.
This can happen when the pc being looked up is below the minimum pc
provided by the lookup table. Fix this by not running the search loop if
the pc is out of bounds and instead just return the lowest possible
looked up value.
Change-Id: Ib87925c73576eccb3cdb736229daee12b444964b
Signed-off-by:
Xiaozhe Shi <xiaozhes@codeaurora.org>
Loading
Please register or sign in to comment