Skip to content

Commit 51c7b6a

Browse files
linuswsre
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 <[email protected]> Cc: Baolin Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Baolin Wang <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent fa55b7d commit 51c7b6a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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)