提交 49dfedb5 编写于 作者: L Linus Walleij 提交者: Zheng Zengkai

power: supply: core: Break capacity loop

stable inclusion
from stable-v5.10.91
commit 998d157e3b2acf5f605e49805f4c34947f3bad56
bugzilla: 186187 https://gitee.com/openeuler/kernel/issues/I4SI2C

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=998d157e3b2acf5f605e49805f4c34947f3bad56

--------------------------------

commit 51c7b6a0 upstream.

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: 3afb50d7 ("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: NLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: NBaolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: NSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 6f5dd87f
......@@ -834,6 +834,10 @@ power_supply_find_ocv2cap_table(struct power_supply_battery_info *info,
return NULL;
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);
if (temp_diff < best_temp_diff) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册