summaryrefslogtreecommitdiff
path: root/common/charge_manager.c
diff options
context:
space:
mode:
authorFabien Parent <fparent@baylibre.com>2018-05-15 10:50:53 +0200
committerchrome-bot <chrome-bot@chromium.org>2018-05-16 05:08:36 -0700
commitcd89b400a22702ab327b6fd261cd7d5c53b421e3 (patch)
tree63c9167075c13eecdca4bbcce4065806da69fecf /common/charge_manager.c
parent1d114ffa3ccca7fd99a49a67754806e3655d7fe6 (diff)
downloadchrome-ec-cd89b400a22702ab327b6fd261cd7d5c53b421e3.tar.gz
charge_manager: handle gracefully dedicated port
charge_manager_fill_power_info can be called to fill the power info of the dedicated port. This function might call charge_manager_get_source_current with the dedicated port, we don't want to use assert in that case, but just fail gracefully by returning 0. BRANCH=None BUG=chromium:841944 TEST=Check that the function returns 0 for dedicated and not 0 for USB. Change-Id: I357c056647e01bdb0e77a08a6c6b492aa3dbb503 Signed-off-by: Fabien Parent <fparent@baylibre.com> Reviewed-on: https://chromium-review.googlesource.com/1059248 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/charge_manager.c')
-rw-r--r--common/charge_manager.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 2c30ca7bc8..c1fa917665 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -217,7 +217,8 @@ static int charge_manager_is_seeded(void)
*/
static int charge_manager_get_source_current(int port)
{
- ASSERT(is_pd_port(port));
+ if (!is_pd_port(port))
+ return 0;
switch (source_port_last_rp[port]) {
case TYPEC_RP_3A0: