summaryrefslogtreecommitdiff
path: root/board/kukui/base_detect_krane.c
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2019-08-02 20:29:30 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-06 10:42:25 +0000
commit8e6cbfe9da81862da48c250737cb9e77d175b2b3 (patch)
tree084b7d20f2ad4866b97ffa63235f804dad581db9 /board/kukui/base_detect_krane.c
parent2cfd12facff02ead45addb10c4dd363402eb8898 (diff)
downloadchrome-ec-8e6cbfe9da81862da48c250737cb9e77d175b2b3.tar.gz
kukui: fix tcpc_init failed on kukui
Calling board_pogo_charge_init() when DEDICATED_CHARGE_PORT disabled causes buffer overflow inside charge manager, move the function to a suitable place to fix the issue. BUG=b:138741956 TEST=flash and verify that kukui is bootable BRANCH=master Change-Id: I43d8aabf8fd21ed62a37671ba7cd471c8c188b9f Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731212 Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Yilun Lin <yllin@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'board/kukui/base_detect_krane.c')
-rw-r--r--board/kukui/base_detect_krane.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/board/kukui/base_detect_krane.c b/board/kukui/base_detect_krane.c
index 2ec9fa7d2e..13f0fc6744 100644
--- a/board/kukui/base_detect_krane.c
+++ b/board/kukui/base_detect_krane.c
@@ -159,3 +159,14 @@ static void base_init(void)
hook_call_deferred(&base_detect_deferred_data, 0);
}
DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_INIT_ADC + 1);
+
+static void board_pogo_charge_init(void)
+{
+ int i;
+
+ /* Initialize all charge suppliers to 0 */
+ for (i = 0; i < CHARGE_SUPPLIER_COUNT; i++)
+ charge_manager_update_charge(i, CHARGE_PORT_POGO, NULL);
+}
+DECLARE_HOOK(HOOK_INIT, board_pogo_charge_init,
+ HOOK_PRIO_CHARGE_MANAGER_INIT + 1);