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>
This commit is contained in:
Fabien Parent
2018-05-15 10:50:53 +02:00
committed by chrome-bot
parent 1d114ffa3c
commit cd89b400a2

View File

@@ -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: