mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 19:23:57 +08:00
power: supply: core: Break capacity loop
We should not go on looking for more capacity tables after
we realize we have looked at the last one in
power_supply_find_ocv2cap_table().
Fixes: 3afb50d712
("power: supply: core: Add some helpers to use the battery OCV capacity table")
Cc: Chunyan Zhang <chunyan.zhang@unisoc.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
fa55b7dcdc
commit
51c7b6a039
@ -853,6 +853,10 @@ power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < POWER_SUPPLY_OCV_TEMP_MAX; i++) {
|
for (i = 0; i < POWER_SUPPLY_OCV_TEMP_MAX; i++) {
|
||||||
|
/* Out of capacity tables */
|
||||||
|
if (!info->ocv_table[i])
|
||||||
|
break;
|
||||||
|
|
||||||
temp_diff = abs(info->ocv_temp[i] - temp);
|
temp_diff = abs(info->ocv_temp[i] - temp);
|
||||||
|
|
||||||
if (temp_diff < best_temp_diff) {
|
if (temp_diff < best_temp_diff) {
|
||||||
|
Loading…
Reference in New Issue
Block a user