Skip to content

Commit 51c7b6a

Browse files
Linus Walleijsre
authored andcommitted
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: 3afb50d ("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>
1 parent fa55b7d commit 51c7b6a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/power/supply/power_supply_core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,10 @@ power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
853853
return NULL;
854854

855855
for (i = 0; i < POWER_SUPPLY_OCV_TEMP_MAX; i++) {
856+
/* Out of capacity tables */
857+
if (!info->ocv_table[i])
858+
break;
859+
856860
temp_diff = abs(info->ocv_temp[i] - temp);
857861

858862
if (temp_diff < best_temp_diff) {

0 commit comments

Comments
 (0)